Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
|
|
@ -0,0 +1,17 @@
|
|||
(defun partition (p xs)
|
||||
(if (endp xs)
|
||||
(mv nil nil)
|
||||
(mv-let (less more)
|
||||
(partition p (rest xs))
|
||||
(if (< (first xs) p)
|
||||
(mv (cons (first xs) less) more)
|
||||
(mv less (cons (first xs) more))))))
|
||||
|
||||
(defun qsort (xs)
|
||||
(if (endp xs)
|
||||
nil
|
||||
(mv-let (less more)
|
||||
(partition (first xs) (rest xs))
|
||||
(append (qsort less)
|
||||
(list (first xs))
|
||||
(qsort more)))))
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
> (qsort '(8 6 7 5 3 0 9))
|
||||
(0 3 5 6 7 8 9)
|
||||
Loading…
Add table
Add a link
Reference in a new issue