3 ms·
In this paper they show how to do something like this in CL. http://rali.iro.umontreal.ca/Publications/urls/LapalmeLispComp.pdf http://rali.iro.umontreal.ca/Pub
by martinflack 18y ago
In this paper they show how to do something like this in CL.
http://rali.iro.umontreal.ca/Publications/urls/LapalmeLispComp.pdf http://rali.iro.umontreal.ca/Publications/urls/LapalmeLispCo...
(defun qsort (ax)
(and ax
(let ((a (car ax))
(x (cdr ax)))
(append (qsort [y (y <- x) (< y a)])
(list a)
(qsort [y (y <- x) (>= y a)])))))
If you want the x:xs stuff you could load fare-matcher and write something like:
(defun qsort (l)
(ematch l
(nil nil)
((cons x xs) (append (qsort [ i (i <- xs) (< i x) ])
(list x)
(qsort [ i (i <- xs) (>= i x) ])))))