Created
January 2, 2014 09:25
-
-
Save samrat/8216793 to your computer and use it in GitHub Desktop.
max-key-val
This file contains hidden or 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 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