(def sort-by-commonest (xs) ((afn (rx rs) (if (empty rx) rs (let (x n)(commonest rx) (self (rem x rx)(join rs (n-of n x)))))) xs nil)) arc> (sort-by-commonest '(1 3 3 4 4 5 4)) (4 4 4 3 3 5 1)
-----