Skip to content

Instantly share code, notes, and snippets.

@richhollis
Last active December 28, 2015 19:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richhollis/7548877 to your computer and use it in GitHub Desktop.
Save richhollis/7548877 to your computer and use it in GitHub Desktop.
Crash course in Clojure - Week 1 Homework
(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)
@richhollis
Copy link
Author

({:href "spotify:track:68PHBS4CsrBK8QnRmeGqup",
  :track-number "1",
  :artists
  [{:href "spotify:artist:21E3waRsmPlU7jZsS13rcj", :name "Ne-Yo"}],
  :name "Let Me Love You (Until You Learn To Love Yourself)",
  :external-ids [{:type "isrc", :id "USUM71207198"}],
  :popularity "0.7",
  :length 254.39,
  :album
  {:href "spotify:album:3IqZoTqfNBZtGDQLFRHBAR",
   :name "Let Me Love You (Until You Learn To Love Yourself)",
   :availability
   {:territories
    "AR AT AU BE CH DE DK EE ES FI FR GB GR HK IE IS IT LT LU LV MY NL NO NZ PL PT SG TR TW"},
   :released "2012"}}
 {:href "spotify:track:7lJUnNQC5IX4f2OwH23cBF",
  :track-number "1",
  :artists
  [{:href "spotify:artist:21E3waRsmPlU7jZsS13rcj", :name "Ne-Yo"}],
  :name "Let Me Love You (Until You Learn To Love Yourself)",
  :external-ids [{:type "isrc", :id "USUM71207198"}],
  :popularity "0.7",
  :length 254.39,
  :album
  {:href "spotify:album:39h0PMiDnWXboQBCwvn60E",
   :name "Let Me Love You (Until You Learn To Love Yourself)",
   :availability {:territories "CA MX US"},
   :released "2012"}}
 {:href "spotify:track:3VZQshi4COChhXaz7cLP02",
  :track-number "1",
  :artists
  [{:href "spotify:artist:1VBflYyxBhnDc9uVib98rw", :name "Icona Pop"}],
  :name "I Love It [feat. Charli XCX] - Original Version",
  :external-ids [{:type "isrc", :id "USAT21202802"}],
  :explicit true,
  :popularity "0.87",
  :length 155.536,
  :album
  {:href "spotify:album:5hf74KpfuwSJXVs85k3dVI",
   :name "I Love It",
   :availability
   {:territories
    "AT BE CA CH DE DK EE ES FI FR GB GR IE IS IT LT LU LV NL NO NZ PL PT TR US"},
   :released "2012"}})
("Let Me Love You (Until You Learn To Love Yourself)" "Let Me Love You (Until You Learn To Love Yourself)" "I Love It [feat. Charli XCX] - Original Version" "My Heart Will Go On (Love Theme from \"Titanic\")" "Feel The Love - feat. John Newman" "Feel The Love - feat. John Newman" "Same Love - feat. Mary Lambert" "Same Love - feat. Mary Lambert" "River Flows In You - Original" "Make You Feel My Love (album)" "Me Enamore (Feeling of Love)" "Love Me Again - Kove Remix" "As Long As You Love Me" "Just Give Me a Reason" "Just Give Me a Reason" "Just Give Me a Reason" "All You Need Is Love" "Love The Way You Lie" "Million Dollar Bills" "Love The Way You Lie" "Haven't Met You Yet" "Other Side Of Love" "International Love" "Love Will Remember" "I And Love And You" "Limit To Your Love" "Love Is All I Got" "Parking Lot Party" "I Need Your Love" "Love Money Party" "The Game of Love" "Pusher Love Girl" "This Head I Hold" "Let Me Love You" "Love Like Crazy" "What About Love" "What About Love" "Best Love Song" "Love Love Love" "Love Love Love" "Loud Like Love" "Love Me Again" "The Love Club" "Crazy In Love" "Love Somebody" "We Found Love" "Stubborn Love" "Stubborn Love" "We Found Love" "Love Somebody" "Love Me Again" "We Found Love" "We Found Love" "Bleeding Love" "Another Love" "Made to Love" "Who You Love" "This Is Love" "Hard To Love" "Give Me Love" "What Is Love" "Give Me Love" "Skinny Love" "Skinny Love" "Skinny Love" "Love On Top" "Skinny Love" "How To Love" "Higher Love" "Summer Love" "How To Love" "Disco Love" "Love Story" "Angel Eyes" "Love More" "True Love" "True Love" "All Of Me" "I Love It" "Love Sosa" "Love Song" "Only Love" "Crew Love" "Cali Love" "Love More" "Your Love" "This Love" "Hey Love" "Float On" "Love Me" "Love Me" "Love Me" "Love Me" "Love Me" "Love Me" "No Love" "Bravado" "Royals" "Afraid" "Try")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment