diff --git a/project.clj b/project.clj index e553fe4..02eacd1 100644 --- a/project.clj +++ b/project.clj @@ -4,6 +4,9 @@ [koan-engine "0.2.1"]] :dev-dependencies [[lein-koan "0.1.2"]] :profiles {:dev {:dependencies [[lein-koan "0.1.2"]]}} - :repl-options {:init-ns user} + :repl-options { + :init-ns koan-engine.runner + :init (use 'koan-engine.core) + } :plugins [[lein-koan "0.1.2"]] :main koan-engine.runner/exec) diff --git a/src/koans/01_equalities.clj b/src/koans/01_equalities.clj index aead9f8..4d55376 100644 --- a/src/koans/01_equalities.clj +++ b/src/koans/01_equalities.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.01-equalities (:use koan-engine.core)) + (meditations "We shall contemplate truth by testing reality, via equality" (= __ true) diff --git a/src/koans/02_lists.clj b/src/koans/02_lists.clj index cf246f4..a573c68 100644 --- a/src/koans/02_lists.clj +++ b/src/koans/02_lists.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.02-lists (:use koan-engine.core)) + (meditations "Lists can be expressed by function or a quoted form" (= '(__ __ __ __ __) (list 1 2 3 4 5)) diff --git a/src/koans/03_vectors.clj b/src/koans/03_vectors.clj index 83e6ef0..2fc2699 100644 --- a/src/koans/03_vectors.clj +++ b/src/koans/03_vectors.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.03-vectors (:use koan-engine.core)) + (meditations "You can use vectors in clojure as array-like structures" (= __ (count [42])) diff --git a/src/koans/04_sets.clj b/src/koans/04_sets.clj index 256bd47..ae68d0a 100644 --- a/src/koans/04_sets.clj +++ b/src/koans/04_sets.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.04-sets (:use koan-engine.core)) + (meditations "You can create a set by converting another collection" (= #{3} (set __)) diff --git a/src/koans/05_maps.clj b/src/koans/05_maps.clj index 812d2b1..f787270 100644 --- a/src/koans/05_maps.clj +++ b/src/koans/05_maps.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.05-maps (:use koan-engine.core)) + (meditations "Don't get lost when creating a map" (= {:a 1 :b 2} (hash-map :a 1 __ __)) diff --git a/src/koans/06_functions.clj b/src/koans/06_functions.clj index 6be6f16..515e8a0 100644 --- a/src/koans/06_functions.clj +++ b/src/koans/06_functions.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.06-functions (:use koan-engine.core)) + (defn multiply-by-ten [n] (* 10 n)) diff --git a/src/koans/07_conditionals.clj b/src/koans/07_conditionals.clj index 308d569..4ee44d8 100644 --- a/src/koans/07_conditionals.clj +++ b/src/koans/07_conditionals.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.07-conditionals (:use koan-engine.core)) + (defn explain-defcon-level [exercise-term] (case exercise-term :fade-out :you-and-what-army diff --git a/src/koans/08_higher_order_functions.clj b/src/koans/08_higher_order_functions.clj index 0d53b94..8fe93d7 100644 --- a/src/koans/08_higher_order_functions.clj +++ b/src/koans/08_higher_order_functions.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.08-higher-order-functions (:use koan-engine.core)) + (meditations "The map function relates a sequence to another" (= [__ __ __] (map (fn [x] (* 4 x)) [1 2 3])) diff --git a/src/koans/09_runtime_polymorphism.clj b/src/koans/09_runtime_polymorphism.clj index 56d37c5..b81ca73 100644 --- a/src/koans/09_runtime_polymorphism.clj +++ b/src/koans/09_runtime_polymorphism.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.09-runtime-polymorphism (:use koan-engine.core)) + (defn hello ([] "Hello World!") ([a] (str "Hello, you silly " a ".")) diff --git a/src/koans/10_lazy_sequences.clj b/src/koans/10_lazy_sequences.clj index eb5c5f3..f899db3 100644 --- a/src/koans/10_lazy_sequences.clj +++ b/src/koans/10_lazy_sequences.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.10-lazy-sequences (:use koan-engine.core)) + (meditations "There are many ways to generate a sequence" (= __ (range 1 5)) diff --git a/src/koans/11_sequence_comprehensions.clj b/src/koans/11_sequence_comprehensions.clj index ab03bb0..95d42d9 100644 --- a/src/koans/11_sequence_comprehensions.clj +++ b/src/koans/11_sequence_comprehensions.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.11-sequence-comprehensions (:use koan-engine.core)) + (meditations "Sequence comprehensions can bind each element in turn to a symbol" (= __ diff --git a/src/koans/12_creating_functions.clj b/src/koans/12_creating_functions.clj index 84ff21e..716844b 100644 --- a/src/koans/12_creating_functions.clj +++ b/src/koans/12_creating_functions.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.12-creating-functions (:use koan-engine.core)) + (defn square [x] (* x x)) (meditations diff --git a/src/koans/13_recursion.clj b/src/koans/13_recursion.clj index 2d9eb42..9f1277f 100644 --- a/src/koans/13_recursion.clj +++ b/src/koans/13_recursion.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.13-recursion (:use koan-engine.core)) + (defn is-even? [n] (if (= n 0) __ diff --git a/src/koans/14_destructuring.clj b/src/koans/14_destructuring.clj index 700ae5c..a10b174 100644 --- a/src/koans/14_destructuring.clj +++ b/src/koans/14_destructuring.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.14-destructuring (:use koan-engine.core)) + (def test-address {:street-address "123 Test Lane" :city "Testerville" diff --git a/src/koans/15_refs.clj b/src/koans/15_refs.clj index 0f9b2d2..e6e0772 100644 --- a/src/koans/15_refs.clj +++ b/src/koans/15_refs.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.15-refs (:use koan-engine.core)) + (def the-world (ref "hello")) (def bizarro-world (ref {})) diff --git a/src/koans/16_atoms.clj b/src/koans/16_atoms.clj index cd48a10..0c252e0 100644 --- a/src/koans/16_atoms.clj +++ b/src/koans/16_atoms.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.16-atoms (:use koan-engine.core)) + (def atomic-clock (atom 0)) (meditations diff --git a/src/koans/17_macros.clj b/src/koans/17_macros.clj index ec0d9c4..8ea5dbb 100644 --- a/src/koans/17_macros.clj +++ b/src/koans/17_macros.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.17-macros (:use koan-engine.core)) + (defmacro hello [x] (str "Hello, " x)) diff --git a/src/koans/18_datatypes.clj b/src/koans/18_datatypes.clj index 9a72d1a..a4e1597 100644 --- a/src/koans/18_datatypes.clj +++ b/src/koans/18_datatypes.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.18-datatypes (:use koan-engine.core)) + (defrecord Nobel [prize]) (deftype Pulitzer [prize]) diff --git a/src/koans/19_java_interop.clj b/src/koans/19_java_interop.clj index 2a86d08..bf09527 100644 --- a/src/koans/19_java_interop.clj +++ b/src/koans/19_java_interop.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.19-java-interop (:use koan-engine.core)) + (meditations "You may have done more with Java than you know" (= __ (class "warfare")) ; hint: try typing (javadoc "warfare") in the REPL diff --git a/src/koans/20_partition.clj b/src/koans/20_partition.clj index 0ec5e29..b0d5cdf 100644 --- a/src/koans/20_partition.clj +++ b/src/koans/20_partition.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.20-partition (:use koan-engine.core)) + (meditations "To split a collection you can use the partition function" (= '((0 1) (2 3)) (__ 2 (range 4))) diff --git a/src/koans/21_group_by.clj b/src/koans/21_group_by.clj index f27a967..581dcb1 100644 --- a/src/koans/21_group_by.clj +++ b/src/koans/21_group_by.clj @@ -1,3 +1,6 @@ +(ns koan-engine.runner) +(ns koans.21-group-by (:use koan-engine.core)) + (defn get-odds-and-evens [coll] (let [{odds true evens false} (group-by __ coll)] [odds evens]))