Home | Articles | CV (pdf)
<2011-06-17> by Lorenzo Bolla

sleepsort

To honor the funniest thread in months, here is a lisp implementation of sleepsort!

(use-package :sb-thread)

(defun show (item)
    (sleep item)
    (format t "~S~%" item))

(defun sleep-sort (lst)
    (mapcar
    #'(lambda (item) (make-thread #'(lambda () (show item))))
    lst))