Created
July 3, 2014 21:36
-
-
Save trikitrok/a86616ebcc9dc8667b7d to your computer and use it in GitHub Desktop.
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
| (ns school) | |
| (defn grade [school grade-num] | |
| (get school grade-num [])) | |
| (defn add [school name grade-num] | |
| (assoc | |
| school | |
| grade-num | |
| (conj (grade school grade-num) name))) | |
| (defn sorted [school] | |
| (let | |
| [sort-by-grades | |
| (partial sort-by key) | |
| sort-students-by-name | |
| (partial map | |
| (fn [[grade students]] | |
| [grade (sort students)]))] | |
| (into | |
| {} | |
| (-> | |
| school | |
| sort-by-grades | |
| sort-students-by-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment