#362
The Librarian's Dilemma
 

Difficulty:Easy
Topics:Real life cases List of Maps


Mission: "The Librarian's Dilemma" adalah tantangan yang dihadapi setiap pustakawan di akhir hari. Dengan list of maps yang merepresentasikan buku-buku yang dikembalikan hari ini, di mana setiap map berisi :title, :author, dan :genre, misi elo adalah untuk mengelompokkan buku-buku tersebut berdasarkan :genre dan menghitung jumlah buku di setiap genre tersebut. Return sebuah map dengan genre sebagai kunci dan jumlah buku sebagai nilai.
test not run
(= (__ [{:title "Clojure for the Brave and True" :author "Daniel Higginbotham" :genre "Programming"}
        {:title "Harry Potter and the Sorcerer's Stone" :author "J.K. Rowling" :genre "Fantasy"}
        {:title "The Joy of Clojure" :author "Michael Fogus" :genre "Programming"}])
   {"Programming" 2, "Fantasy" 1})
test not run
(= (__ [{:title "Educational Psychology" :author "John Santrock" :genre "Psychology"}
        {:title "How Learning Works" :author "Susan Ambrose" :genre "Education"}
        {:title "Mindset" :author "Carol Dweck" :genre "Psychology"}])
   {"Psychology" 2, "Education" 1})
test not run
(= (__ []) {})
test not run
(= (__ [{:title "The Lean Startup" :author "Eric Ries" :genre "Business"}
        {:title "Zero to One" :author "Peter Thiel" :genre "Business"}
        {:title "Measure What Matters" :author "John Doerr" :genre "Business"}])
   {"Business" 3})


Code which fills in the blank: