Last active
December 28, 2015 19:18
-
-
Save richhollis/7548877 to your computer and use it in GitHub Desktop.
Crash course in Clojure - Week 1 Homework
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
(require 'crash-course-clojure.spotify) | |
(use 'crash-course-clojure.spotify) | |
(def tracks | |
(love :tracks) | |
) | |
(def tracks-sorted | |
(sort (fn [x y] (> (count(x :name)) (count(y :name)))) tracks) | |
) | |
; show the first three longest track names | |
(pprint (take 3 tracks-sorted)) | |
; the complete list of tracks, sorted by longest track name | |
(map (fn [track] (track :name)) tracks-sorted) |
Author
richhollis
commented
Nov 19, 2013
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment