Skip to content

Instantly share code, notes, and snippets.

@samrat
Created January 2, 2014 09:25
Show Gist options
  • Save samrat/8216793 to your computer and use it in GitHub Desktop.
Save samrat/8216793 to your computer and use it in GitHub Desktop.
max-key-val
(defn max-key-val
[f & args]
(reduce (fn [[max f-of-max] i]
(let [f-of-i (f i)]
(if (> f-of-i f-ofmax)
[i f-of-i]
[max f-of-max])))
[(first args) (f (first args))]
(rest args)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment