Hacker News new | ask | show | jobs
by nabla9 1520 days ago
Common Lisp:

prompt:

    (defun sort (a b)

result:

  (defun sort (a b)
    (declare (optimize (speed 3) (debug 3))
    (type t a b))
    (if (eq a b)
        nil
     (let ((t (comp (compare a b) (const 1))))
       (when (eq t 0)
         (return a b))
       (sort (comp (sort a t) (const 2)) b))))

 For a small array it takes approximately 6 times longer to sort with this method. I would still like to hear if   there is a faster solution.