Skip to content

Instantly share code, notes, and snippets.

@elarkin
Created December 10, 2014 15:12
Show Gist options
  • Save elarkin/25796c34e91793a10b9c to your computer and use it in GitHub Desktop.
Save elarkin/25796c34e91793a10b9c to your computer and use it in GitHub Desktop.
Card question in clojure
(ns foo.card-q)
(def deck
"Given a set of cards, return a deck of those cards"
vector)
(def card
"Given a map of card properties, return a card with those properties"
identity)
(def shuffle-deck
"Given a deck, return a new deck with the cards in a random order"
shuffle)
(def combine-decks
"Given 1+ decks, return a new deck with all of the cards from all decks"
concat) ; or (comp doall concat) if you want eagerness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment