clojure-koans/src/koans/conditionals.clj

25 lines
516 B
Clojure
Raw Normal View History

2010-02-09 23:37:22 +00:00
(meditations
2010-05-07 02:56:43 +00:00
"You will face many decisions"
(= __ (if (false? (= 4 5))
:a
:b))
2010-02-09 23:37:22 +00:00
"Some of them leave you no alternative"
(= __ (if (> 4 3)
[]))
2010-02-09 23:37:22 +00:00
"And in such a case you may have nothing"
(= nil (if (nil? __)
[:a :b :c]))
2010-05-07 02:56:43 +00:00
"In others your alternative may be interesting"
(= :glory (if (not (empty? ()))
:doom
__))
2010-05-07 02:56:43 +00:00
"Or your fate may be sealed"
(= __ (if-not (zero? __)
'doom
'doom)))
2010-02-09 23:37:22 +00:00