( (defun split_inner (@ everything (rest aggl aggr)) (if rest (split_inner (r rest) aggr (c (f rest) aggl)) (r everything) ) ) (defun split (mylist) (split_inner mylist 0 0) ) (defun merge_inner (myless A B agg) ; this should use continued if (if (not A) (prepend (reverse agg) B) (if (not B) (prepend (reverse agg) A) (if (a myless (list (f A) (f B))) (merge_inner myless (r A) B (c (f A) agg)) (merge_inner myless A (r B) (c (f B) agg)) ) ) ) ) (defun merge (myless a b) (merge_inner myless a b 0) ) (defun sort-split (myless (a b)) (merge myless (sort myless a) (sort myless b)) ) (defun sort (myless mylist) (if mylist (if (r mylist) (assign (a b) (split mylist) sa (sort myless a) sb (sort myless b) (merge myless sa sb) ) mylist ) () ) ) )