From fa90fc7e86b80679a04da456ce5fa34c8d988eef Mon Sep 17 00:00:00 2001 From: Colin Jones Date: Wed, 3 Nov 2010 20:38:20 -0500 Subject: [PATCH] Add cond; fix typo. --- src/koans/conditionals.clj | 6 ++++++ src/path_to_answer_sheet.clj | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/koans/conditionals.clj b/src/koans/conditionals.clj index dc746b8..be71a3d 100644 --- a/src/koans/conditionals.clj +++ b/src/koans/conditionals.clj @@ -17,6 +17,12 @@ :doom __)) + "You may have a multitude of possible paths" + (let [x 5] + (= :your_road (cond (= x __) :road_not_taken + (= x __) :another_road_not_taken + :else __))) + "Or your fate may be sealed" (= __ (if-not (zero? __) 'doom diff --git a/src/path_to_answer_sheet.clj b/src/path_to_answer_sheet.clj index 8ea6c47..f8dd562 100644 --- a/src/path_to_answer_sheet.clj +++ b/src/path_to_answer_sheet.clj @@ -60,6 +60,7 @@ [] 0 :glory + 4 6 :your_road "'doom" 0 ]} "higher_order_functions" {"__" [4 8 12 "(* x x)" @@ -87,7 +88,7 @@ :a :b :c :d :c :d] "___" ["multiply-by-5"]} - "factorial" {"__" ["(loop [n n acc 1] + "recursion" {"__" ["(loop [n n acc 1] (if (zero? n) acc (recur (dec n) (* acc n))))"]}