Created
June 17, 2012 14:09
-
-
Save raek/2944661 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
(defn my-max [coll] | |
(let [[first-value first-freq] (first coll)] | |
(loop [max-value first-value | |
max-freq first-freq | |
coll (rest coll)] | |
(if (empty? coll) | |
max-value | |
(let [[value freq] (first coll)] | |
(if (> freq max-freq) | |
(recur value freq (rest coll)) | |
(recur max-value max-freq (rest coll)))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment