(defmacro while (test &rest body) `(do () ((not ,test)) ,@body)) (deftest bryan-quicksort () (labels ((quicksort (vec l r) (let ((i l) (j r) (p (svref vec (round (+ l r) 2)))) (while (<= i j) (while (< (svref vec i) p) (incf i)) (while (> (svref vec j) p) (decf j)) (when (<= i j) (rotatef (svref vec i) (svref vec j)) (incf i) (decf j))) (if (> (- j l) 1) (quicksort vec l j)) (if (> (- r i) 1) (quicksort vec i r))) vec)) (check (samep "#(1 2 3)" (quicksort (vector 3 2 1) 0 2)))))