src/grade_school.clj

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
(ns grade-school)

(defn add [db student grade]
  "Add student to grade"
  (merge-with into db {grade [student]}))

(defn grade [db grade]
  "Get students in a grade"
  (db grade []))

(defn sorted [db]
  "Get sorted list of all students in all grades"
  (into
    (sorted-map)
    (map (fn [[k v]] [k (sort v)]) db)))

Comments


You're not logged in right now. Please login via GitHub to comment