Created
November 20, 2012 15:54
-
-
Save losingkeys/4118756 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
(def playlist | |
[{:title "Elephant", :artist "The White Stripes", :year 2003} | |
{:title "Helioself", :artist "Papas Fritas", :year 1997} | |
{:title "Stories from the City, Stories from the Sea", | |
:artist "PJ Harvey", :year 2000} | |
{:title "Buildings and Grounds", :artist "Papas Fritas", :year 2000} | |
{:title "Zen Rodeo", :artist "Mardi Gras BB", :year 2002}]) | |
; (group-by :artist playlist) returns: | |
;= {"Papas Fritas" [{:title "Helioself", :artist "Papas Fritas", :year 1997} | |
;= {:title "Buildings and Grounds", :artist "Papas Fritas"}] | |
;= ...} | |
; desired: | |
;= {"Papas Fritas" [{:title "Helioself", :year 1997} | |
;= {:title "Buildings and Grounds"}] | |
;= ...} | |
; from http://www.clojurebook.com/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment