I have written a Clojure function that can successfully sort a list of lists according to length frequency.
However, I don't like the way it is written. Does anyone have any suggestions for writing this in a different way?
(defn lfsort [n]
(let [total (frequencies (map #(count %) n))]
(sort #(< (total (count %1)) (total (count %2))) n)))
(lfsort '((a b c) (d e) (f g h) (d e) (i j k l) (m n) (o)))
((i j k l) (o) (a b c) (f g h) (d e) (d e) (m n))
Kind Regards, Ben.