2016-02-29 23:25:51 +00:00
|
|
|
(defn explain-exercise-velocity [exercise-term]
|
|
|
|
|
(case exercise-term
|
|
|
|
|
:ten-mph :pretty-fast
|
|
|
|
|
:watching-tv :not-so-fast))
|
|
|
|
|
|
|
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
|
|
|
|
|
; "You will face many decisions"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= :a (if (false? (= 4 5))
|
2011-10-26 02:55:54 +00:00
|
|
|
:a
|
|
|
|
|
:b))
|
2010-02-09 23:37:22 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "Some of them leave you no alternative"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= [] (if (> 4 3) ;; J - This is the equivalent of an if statement without an else.
|
|
|
|
|
[])) ;; returns nil if false as seen below.
|
2010-02-09 23:37:22 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "And in such a situation you may have nothing"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= nil (if (nil? 0)
|
2011-10-26 02:55:54 +00:00
|
|
|
[:a :b :c]))
|
2010-05-07 02:56:43 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "In others your alternative may be interesting"
|
2010-11-03 03:29:45 +00:00
|
|
|
(= :glory (if (not (empty? ()))
|
2011-10-26 02:55:54 +00:00
|
|
|
:doom
|
2016-02-29 23:25:51 +00:00
|
|
|
:glory))
|
2010-05-07 02:56:43 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "You may have a multitude of possible paths"
|
2010-11-04 01:38:20 +00:00
|
|
|
(let [x 5]
|
2016-02-29 23:25:51 +00:00
|
|
|
(= :your-road (cond (= x 3) :road-not-taken
|
|
|
|
|
(= x 2) :another-road-not-taken
|
|
|
|
|
:else :your-road))) ;; J - The syntax and formatting of this statement
|
|
|
|
|
;; are crucial in writing these statements correctly.
|
2010-11-04 01:38:20 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "Or your fate may be sealed"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= 'doom (if-not (zero? 1)
|
2011-10-26 02:55:54 +00:00
|
|
|
'doom
|
2013-11-22 19:52:20 +00:00
|
|
|
'more-doom))
|
2011-04-29 20:34:17 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "In case of emergency, go fast"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= :pretty-fast
|
|
|
|
|
(explain-exercise-velocity :ten-mph))
|
2011-04-29 20:34:17 +00:00
|
|
|
|
2016-02-27 02:33:05 +00:00
|
|
|
; "But admit it when you don't know what to do"
|
2016-02-29 23:25:51 +00:00
|
|
|
(= :not-so-fast
|
2016-02-27 02:33:05 +00:00
|
|
|
(explain-exercise-velocity :watching-tv))
|