Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
playing cards
(fn [s]
(let [suit (first s) rank (last s)
st (case suit
\D :diamond
\C :club
\S :spade)
rk (try
(- (Integer/parseInt rank) 2)
(catch NumberFormatException e
(case rank
\T 8
\J 9
\Q 10
\K 11
\A 12)))]
{:suit st
:rank rk}))
;; 4clojure
; "You tripped the alarm! catch is bad!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.