-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path07_conditionals.clj
46 lines (38 loc) · 1.19 KB
/
07_conditionals.clj
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
(defn explain-defcon-level [exercise-term]
(case exercise-term
:fade-out :you-and-what-army
:double-take :call-me-when-its-important
:round-house :o-rly
:fast-pace :thats-pretty-bad
:cocked-pistol :sirens
:say-what?))
(meditations
"You will face many decisions"
(= :a (if (false? (= 4 5))
:a
:b))
"Some of them leave you no alternative"
(= [] (if (> 4 3)
[]))
"And in such a situation you may have nothing"
(= 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 2) :road-not-taken
(= x 3) :another-road-not-taken
:else :your-road)))
"Or your fate may be sealed"
(= 'doom (if-not (zero? 0)
'doom
'doom))
"In case of emergency, sound the alarms"
(= :sirens
(explain-defcon-level :cocked-pistol))
"But admit it when you don't know what to do"
(= :say-what?
(explain-defcon-level :yo-mama)))