Skip to content

Commit

Permalink
Completed conditionals koans
Browse files Browse the repository at this point in the history
  • Loading branch information
hgmnz committed Mar 24, 2012
1 parent dd13920 commit a99cdf1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/koans/conditionals.clj
Expand Up @@ -9,38 +9,38 @@

(meditations
"You will face many decisions"
(= __ (if (false? (= 4 5))
(= :a (if (false? (= 4 5))
:a
:b))

"Some of them leave you no alternative"
(= __ (if (> 4 3)
(= [] (if (> 4 3)
[]))

"And in such a situation you may have nothing"
(= __ (if (nil? 0)
(= nil (if (nil? 0)
[:a :b :c]))

"In others your alternative may be interesting"
(= :glory (if (not (empty? ()))
:doom
__))
:glory))

"You may have a multitude of possible paths"
(let [x 5]
(= :your-road (cond (= x __) :road-not-taken
(= x __) :another-road-not-taken
:else __)))
(= :your-road (cond (= x 3) :road-not-taken
(= x 1) :another-road-not-taken
:else :your-road)))

"Or your fate may be sealed"
(= __ (if-not (zero? __)
(= 'doom (if-not (zero? 0)
'doom
'doom))

"In case of emergency, sound the alarms"
(= :sirens
(explain-defcon-level __))
(explain-defcon-level :cocked-pistol))

"But admit it when you don't know what to do"
(= __
(= :say-what?
(explain-defcon-level :yo-mama)))

0 comments on commit a99cdf1

Please sign in to comment.