Skip to content

Instantly share code, notes, and snippets.

@raek
Created June 17, 2012 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raek/2944661 to your computer and use it in GitHub Desktop.
Save raek/2944661 to your computer and use it in GitHub Desktop.
(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