diff --git a/ideaboard.txt b/ideaboard.txt index 084102c..29488dc 100644 --- a/ideaboard.txt +++ b/ideaboard.txt @@ -7,7 +7,6 @@ lazy sequences recursion recursive list processing trampolining -currying / pfa reflection Destructuring Metadata diff --git a/src/koans/conditionals.clj b/src/koans/conditionals.clj index bebf971..dc746b8 100644 --- a/src/koans/conditionals.clj +++ b/src/koans/conditionals.clj @@ -1,16 +1,24 @@ (meditations "You will face many decisions" - (= __ (if (false? (= 4 5)) :a :b)) + (= __ (if (false? (= 4 5)) + :a + :b)) "Some of them leave you no alternative" - (= __ (if (> 4 3) [])) + (= __ (if (> 4 3) + [])) "And in such a case you may have nothing" - (= nil (if (nil? __) [:a :b :c])) + (= nil (if (nil? __) + [:a :b :c])) "In others your alternative may be interesting" - (= :glory (if (not (empty? ())) :doom __)) + (= :glory (if (not (empty? ())) + :doom + __)) "Or your fate may be sealed" - (= __ (if-not (zero? __) 'doom 'doom))) + (= __ (if-not (zero? __) + 'doom + 'doom))) diff --git a/src/koans/functions.clj b/src/koans/functions.clj index 28ca1f8..fcc51d9 100644 --- a/src/koans/functions.clj +++ b/src/koans/functions.clj @@ -1,6 +1,8 @@ (defn multiply-by-ten [n] (* 10 n)) +(defn square [n] (* n n)) + (meditations "Functions are often defined before they are used" (= __ (multiply-by-ten 2)) @@ -18,4 +20,7 @@ "Higher-order functions take function arguments" (= 25 (___ - (fn [n] (* n n))))) + (fn [n] (* n n)))) + + "But they are often better written using the names of functions" + (= 25 (___ square))) diff --git a/src/path_to_answer_sheet.clj b/src/path_to_answer_sheet.clj index 4a84227..b424263 100644 --- a/src/path_to_answer_sheet.clj +++ b/src/path_to_answer_sheet.clj @@ -54,7 +54,8 @@ 10 5 30 2 20 "*"] - "___" ["(fn [f] (f 5))"]} + "___" ["(fn [f] (f 5))" + "(fn [f] 25)"]} "conditionals" {"__" [:a [] 0