clojure-koans/08_conditionals.clj

38 lines
902 B
Clojure
Raw Normal View History

; "You will face many decisions"
(= __ (if (false? (= 4 5))
2011-10-26 02:55:54 +00:00
:a
:b))
2010-02-09 23:37:22 +00:00
; "Some of them leave you no alternative"
(= __ (if (> 4 3)
2011-10-26 02:55:54 +00:00
[]))
2010-02-09 23:37:22 +00:00
; "And in such a situation you may have nothing"
(= __ (if (nil? 0)
2011-10-26 02:55:54 +00:00
[:a :b :c]))
2010-05-07 02:56:43 +00:00
; "In others your alternative may be interesting"
(= :glory (if (not (empty? ()))
2011-10-26 02:55:54 +00:00
:doom
__))
2010-05-07 02:56:43 +00:00
; "You may have a multitude of possible paths"
2010-11-04 01:38:20 +00:00
(let [x 5]
2011-09-23 16:59:29 +00:00
(= :your-road (cond (= x __) :road-not-taken
(= x __) :another-road-not-taken
2010-11-04 01:38:20 +00:00
:else __)))
; "Or your fate may be sealed"
(= 'doom (if-not (zero? __)
2011-10-26 02:55:54 +00:00
'doom
'more-doom))
2011-04-29 20:34:17 +00:00
; "In case of emergency, go fast"
(= "pretty fast"
(explain-exercise-velocity __))
2011-04-29 20:34:17 +00:00
; "But admit it when you don't know what to do"
2011-04-29 20:34:17 +00:00
(= __
(explain-exercise-velocity :watching-tv))