Add name-spaces to the clojure koans files.

This commit adds two name-spaces to beginning of the clojure koan files
in order to fix an issue both #68 and #69.
This commit is contained in:
David Kinzer 2014-01-25 19:04:22 -05:00 committed by Colin Jones
parent fd3972dd78
commit 711925a043
22 changed files with 67 additions and 1 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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))

View File

@ -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]))

View File

@ -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 __))

View File

@ -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 __ __))

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.06-functions (:use koan-engine.core))
(defn multiply-by-ten [n]
(* 10 n))

View File

@ -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

View File

@ -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]))

View File

@ -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 "."))

View File

@ -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))

View File

@ -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"
(= __

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.12-creating-functions (:use koan-engine.core))
(defn square [x] (* x x))
(meditations

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.13-recursion (:use koan-engine.core))
(defn is-even? [n]
(if (= n 0)
__

View File

@ -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"

View File

@ -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 {}))

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.16-atoms (:use koan-engine.core))
(def atomic-clock (atom 0))
(meditations

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.17-macros (:use koan-engine.core))
(defmacro hello [x]
(str "Hello, " x))

View File

@ -1,3 +1,6 @@
(ns koan-engine.runner)
(ns koans.18-datatypes (:use koan-engine.core))
(defrecord Nobel [prize])
(deftype Pulitzer [prize])

View File

@ -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

View File

@ -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)))

View File

@ -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]))