Use forms instead of strings where possible in answer sheet.

master
Colin Jones 14 years ago
parent 47d4342314
commit 7e6ac00457

@ -1,7 +1,6 @@
(ns path-to-answer-sheet (ns path-to-answer-sheet
(:use [path-to-enlightenment :exclude (run)] (:use [path-to-enlightenment :exclude (run)]
[clojure.string :only (join split)] [clojure.string :only (join split)]))
clojure.test))
(def answers (def answers
{"equalities" {"__" [true {"equalities" {"__" [true
@ -32,7 +31,7 @@
:jelly :jelly
:jelly :jelly
[:butter :and]] [:butter :and]]
"___" ["="]} "___" ['=]}
"sets" {"__" [3 "sets" {"__" [3
#{1 2 3 4 5} #{1 2 3 4 5}
#{1 2 3 4 5} #{1 2 3 4 5}
@ -56,8 +55,8 @@
10 5 10 5
30 2 30 2
20 "*"] 20 "*"]
"___" ["(fn [f] (f 5))" "___" ['(fn [f] (f 5))
"(fn [f] 25)"]} '(fn [f] 25)]}
"conditionals" {"__" [:a "conditionals" {"__" [:a
[] []
0 0
@ -65,35 +64,35 @@
4 6 :your_road 4 6 :your_road
"'doom" 0 ]} "'doom" 0 ]}
"higher_order_functions" {"__" [4 8 12 "higher_order_functions" {"__" [4 8 12
"(* x x)" '(* x x)
[false false true false false] [false false true false false]
"()" "()"
true true
"(< x 31)" '(< x 31)
"(* 10 x)" "(< x 4)" '(* 10 x) '(< x 4)
24 24
100 100
"(count a)" "(count b)"]} '(count a) '(count b)]}
"runtime_polymorphism" {"__" ["(str (:name a) \" eats veggies.\")" "runtime_polymorphism" {"__" ['(str (:name a) " eats veggies.")
"(str (:name a) \" eats animals.\")" '(str (:name a) " eats animals.")
"(str \"I don't know what \" (:name a) \" eats.\")" '(str "I don't know what " (:name a) " eats.")
"\"Hello World!\"" "\"Hello World!\""
"\"Hello, you silly world.\"" "\"Hello, you silly world.\""
"\"Hello to this group: Peter, Paul, Mary!\"" ]} "\"Hello to this group: Peter, Paul, Mary!\"" ]}
"sequence_comprehensions" {"__" [[0 1 2 3 4 5] "sequence_comprehensions" {"__" [[0 1 2 3 4 5]
"(* index index)" '(* index index)
"(range 10)" '(range 10)
"(odd? index)" "(* index index)" '(odd? index) '(* index index)
"[row column]" '[row column]
]} ]}
"partial_functions" {"__" [4 "partial_functions" {"__" [4
:a :b :c :d :a :b :c :d
:c :d] :c :d]
"___" ["multiply-by-5"]} "___" ["multiply-by-5"]}
"recursion" {"__" ["(loop [n n acc 1] "recursion" {"__" ['(loop [n n acc 1]
(if (zero? n) (if (zero? n)
acc acc
(recur (dec n) (* acc n))))"]} (recur (dec n) (* acc n))))]}
}) })
(defn replace-with [s k replacements] (defn replace-with [s k replacements]

Loading…
Cancel
Save