Replace frest with fnext for Clojure 1.0.
(defn order-by-freq [coll]
(keys (sort-by #(vector (- (frest %)) (first %)) (frequencies coll))))
When it comes to performance, this version is about as fast as the original version in the article, but it sure is compact, and surprisingly readable. Many thanks to Martin!
No comments:
Post a Comment