diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..7e66a1a --- /dev/null +++ b/.classpath @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.project b/.project new file mode 100644 index 0000000..18ce3c2 --- /dev/null +++ b/.project @@ -0,0 +1,20 @@ + + + clojure-koans + The Clojure koans. + + + + ccw.builder + + + + org.eclipse.jdt.core.javabuilder + + + + + ccw.nature + org.eclipse.jdt.core.javanature + + \ No newline at end of file diff --git a/project.clj b/project.clj index d2bf039..5df0f3c 100644 --- a/project.clj +++ b/project.clj @@ -5,5 +5,6 @@ :dev-dependencies [[lein-koan "0.1.2"]] :profiles {:dev {:dependencies [[lein-koan "0.1.2"]]}} :repl-options {:init-ns user} - :plugins [[lein-koan "0.1.2"]] + :plugins [[lein-koan "0.1.2"] + [lein2-eclipse "2.0.0"]] :main koan-engine.runner/exec) diff --git a/src/koans/01_equalities.clj b/src/koans/01_equalities.clj index aead9f8..819bf42 100644 --- a/src/koans/01_equalities.clj +++ b/src/koans/01_equalities.clj @@ -1,3 +1,6 @@ +(ns koans.01-equalities + (:require (koan-engine [core :refer [meditations __]]))) + (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..9af4f7a 100644 --- a/src/koans/02_lists.clj +++ b/src/koans/02_lists.clj @@ -1,3 +1,6 @@ +(ns koans.02-lists + (:require (koan-engine [core :refer [meditations __]]))) + (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..6c94afa 100644 --- a/src/koans/03_vectors.clj +++ b/src/koans/03_vectors.clj @@ -1,3 +1,6 @@ +(ns koans.03-vectors + (:require (koan-engine [core :refer [meditations __]]))) + (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..81d237a 100644 --- a/src/koans/04_sets.clj +++ b/src/koans/04_sets.clj @@ -1,3 +1,6 @@ +(ns koans.04-sets + (:require (koan-engine [core :refer [meditations __]]))) + (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 f17114a..b9bb709 100644 --- a/src/koans/05_maps.clj +++ b/src/koans/05_maps.clj @@ -1,3 +1,6 @@ +(ns koans.05-maps + (:require (koan-engine [core :refer [meditations __]]))) + (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..76d95b3 100644 --- a/src/koans/06_functions.clj +++ b/src/koans/06_functions.clj @@ -1,3 +1,6 @@ +(ns koans.06-functions + (:require (koan-engine [core :refer [meditations __ ___]]))) + (defn multiply-by-ten [n] (* 10 n)) diff --git a/src/koans/07_conditionals.clj b/src/koans/07_conditionals.clj index 308d569..4322074 100644 --- a/src/koans/07_conditionals.clj +++ b/src/koans/07_conditionals.clj @@ -1,3 +1,6 @@ +(ns koans.07-conditionals + (:require (koan-engine [core :refer [meditations __]]))) + (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..c0eec8b 100644 --- a/src/koans/08_higher_order_functions.clj +++ b/src/koans/08_higher_order_functions.clj @@ -1,3 +1,6 @@ +(ns koans.08-higher-order-functions + (:require (koan-engine [core :refer [meditations __]]))) + (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..4503c7c 100644 --- a/src/koans/09_runtime_polymorphism.clj +++ b/src/koans/09_runtime_polymorphism.clj @@ -1,3 +1,6 @@ +(ns koans.09-runtime-polymorphism + (:require (koan-engine [core :refer [meditations __]]))) + (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..848ff4a 100644 --- a/src/koans/10_lazy_sequences.clj +++ b/src/koans/10_lazy_sequences.clj @@ -1,3 +1,6 @@ +(ns koans.10-lazy-sequences + (:require (koan-engine [core :refer [meditations __]]))) + (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..7b8f8b8 100644 --- a/src/koans/11_sequence_comprehensions.clj +++ b/src/koans/11_sequence_comprehensions.clj @@ -1,3 +1,6 @@ +(ns koans.11-sequence-comprehensions + (:require (koan-engine [core :refer [meditations __]]))) + (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..d9d31d5 100644 --- a/src/koans/12_creating_functions.clj +++ b/src/koans/12_creating_functions.clj @@ -1,3 +1,6 @@ +(ns koans.12-creating-functions + (:require (koan-engine [core :refer [meditations __ ___]]))) + (defn square [x] (* x x)) (meditations diff --git a/src/koans/13_recursion.clj b/src/koans/13_recursion.clj index 2d9eb42..230085d 100644 --- a/src/koans/13_recursion.clj +++ b/src/koans/13_recursion.clj @@ -1,3 +1,6 @@ +(ns koans.13-recursion + (:require (koan-engine [core :refer [meditations __ ___]]))) + (defn is-even? [n] (if (= n 0) __ diff --git a/src/koans/14_destructuring.clj b/src/koans/14_destructuring.clj index 949b5c5..1acd977 100644 --- a/src/koans/14_destructuring.clj +++ b/src/koans/14_destructuring.clj @@ -1,3 +1,6 @@ +(ns koans.14-destructuring + (:require (koan-engine [core :refer [meditations __ ___]]))) + (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..dfdfff7 100644 --- a/src/koans/15_refs.clj +++ b/src/koans/15_refs.clj @@ -1,3 +1,6 @@ +(ns koans.15-refs + (:require (koan-engine [core :refer [meditations __ ___]]))) + (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..83acd53 100644 --- a/src/koans/16_atoms.clj +++ b/src/koans/16_atoms.clj @@ -1,3 +1,6 @@ +(ns koans.16-atoms + (:require (koan-engine [core :refer [meditations __]]))) + (def atomic-clock (atom 0)) (meditations diff --git a/src/koans/17_macros.clj b/src/koans/17_macros.clj index ec0d9c4..8775ebc 100644 --- a/src/koans/17_macros.clj +++ b/src/koans/17_macros.clj @@ -1,3 +1,6 @@ +(ns koans.17-macros + (:require (koan-engine [core :refer [meditations __]]))) + (defmacro hello [x] (str "Hello, " x)) diff --git a/src/koans/18_datatypes.clj b/src/koans/18_datatypes.clj index 9a72d1a..4689b4b 100644 --- a/src/koans/18_datatypes.clj +++ b/src/koans/18_datatypes.clj @@ -1,3 +1,6 @@ +(ns koans.18-datatypes + (:require (koan-engine [core :refer [meditations __]]))) + (defrecord Nobel [prize]) (deftype Pulitzer [prize]) diff --git a/src/koans/19_java_interop.clj b/src/koans/19_java_interop.clj index 2a86d08..3170464 100644 --- a/src/koans/19_java_interop.clj +++ b/src/koans/19_java_interop.clj @@ -1,3 +1,6 @@ +(ns koans.19-java-interop + (:require (koan-engine [core :refer [meditations __ ___]]))) + (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..36d5783 100644 --- a/src/koans/20_partition.clj +++ b/src/koans/20_partition.clj @@ -1,3 +1,6 @@ +(ns koans.20-partition + (:require (koan-engine [core :refer [meditations __]]))) + (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 bd926fc..7e6a5a2 100644 --- a/src/koans/21_group_by.clj +++ b/src/koans/21_group_by.clj @@ -1,3 +1,6 @@ +(ns koans.21-group-by + (:require (koan-engine [core :refer [meditations __]]))) + (defn get-odds-and-evens [coll] (let [{odds true evens false} (group-by __ coll)] [odds evens]))