Created
November 25, 2015 05:03
-
-
Save currentoor/c608331d9a4068bdf11a 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- average [coll] | |
(/ (reduce + coll) (count coll))) | |
(let [paid {:karan 900 | |
:chirag 50 | |
:jindi 400 | |
:harleen 200 | |
:sukh 100 | |
:raman 10} | |
[min-key min-amt] (apply min-key val paid) | |
[max-key max-amt] (apply max-key val paid) | |
avg-cost (average (vals paid)) | |
owed (->> paid | |
(map (fn [[k v]] | |
[k (-> (- v avg-cost) | |
int)])) | |
(into {}))] | |
owed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment