Created
April 23, 2011 21:02
-
-
Save anonymous/938975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; amalloy's solution to http://4clojure.com/problem/53 | |
(let [less (partial apply <)] | |
(fn [coll] | |
(if-let [pairs | |
(seq (->> coll | |
(partition 2 1) | |
(partition-by less) | |
(filter (comp less first))))] | |
(apply cons | |
((juxt ffirst | |
(partial map second)) | |
(apply max-key count (reverse pairs)))) | |
[]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment