Change file/ns names for everything and add 02_strings

This commit is contained in:
Striking 2015-09-13 00:28:39 -05:00
parent 13d95a4f50
commit 7498707bc0
23 changed files with 50 additions and 43 deletions

View File

@ -10,7 +10,11 @@
"hello" "hello"
3]}] 3]}]
["02_lists" {"__" [1 2 3 4 5 ["02_strings" {"__" [
]}]
["03_lists" {"__" [1 2 3 4 5
1 1
[2 3 4 5] [2 3 4 5]
3 3
@ -23,7 +27,7 @@
"No dice!" "No dice!"
()]}] ()]}]
["03_vectors" {"__" [1 ["04_vectors" {"__" [1
[1] [1]
[nil nil] [nil nil]
2 2
@ -34,14 +38,14 @@
[:butter :and] [:butter :and]
3]}] 3]}]
["04_sets" {"__" [[3] ["05_sets" {"__" [[3]
3 3
#{1 2 3 4 5} #{1 2 3 4 5}
#{1 2 3 4 5} #{1 2 3 4 5}
#{2 3} #{2 3}
#{1 4}]}] #{1 4}]}]
["05_maps" {"__" [:b 2 ["06_maps" {"__" [:b 2
1 1
2 2
2 2
@ -57,7 +61,7 @@
2010 2014 2018 2010 2014 2018
"PyeongChang" "Sochi" "Vancouver"]}] "PyeongChang" "Sochi" "Vancouver"]}]
["06_functions" {"__" [81 ["07_functions" {"__" [81
20 20
10 10
60 60
@ -68,7 +72,7 @@
(fn [f] (f 5)) (fn [f] (f 5))
(fn [f] (f 5))]}] (fn [f] (f 5))]}]
["07_conditionals" {"__" [:a ["08_conditionals" {"__" [:a
[] []
nil nil
:glory :glory
@ -77,7 +81,7 @@
:bicycling :bicycling
"is that even exercise?"]}] "is that even exercise?"]}]
["08_higher_order_functions" {"__" [4 8 12 ["09_higher_order_functions" {"__" [4 8 12
(* x x) (* x x)
[false false true false false] [false false true false false]
() ()
@ -88,14 +92,14 @@
100 100
(count a) (count b)]}] (count a) (count b)]}]
["09_runtime_polymorphism" {"__" [(str (:name a) " eats veggies.") ["10_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!" ]}]
["10_lazy_sequences" {"__" [[1 2 3 4] ["11_lazy_sequences" {"__" [[1 2 3 4]
[0 1 2 3 4] [0 1 2 3 4]
10 10
95 95
@ -103,14 +107,14 @@
:a] :a]
"___" [(fn [x] x)]}] "___" [(fn [x] x)]}]
["11_sequence_comprehensions" {"__" [[0 1 2 3 4 5] ["12_sequence_comprehensions" {"__" [[0 1 2 3 4 5]
(* x x) (* x x)
(range 10) (range 10)
(odd? x) (* x x) (odd? x) (* x x)
[row column] [row column]
]}] ]}]
["12_creating_functions" {"__" [true false true ["13_creating_functions" {"__" [true false true
4 4
:a :b :c :d :a :b :c :d
:c :d :c :d
@ -120,7 +124,7 @@
multiply-by-5 multiply-by-5
(comp dec square)]}] (comp dec square)]}]
["13_recursion" {"__" [true ["14_recursion" {"__" [true
acc acc
(loop [coll coll (loop [coll coll
acc ()] acc ()]
@ -134,7 +138,7 @@
(recur (dec n) (* acc n))))] (recur (dec n) (* acc n))))]
"___" [not]}] "___" [not]}]
["14_destructuring" {"__" [":bar:foo" ["15_destructuring" {"__" [":bar:foo"
(format (str "An Oxford comma list of %s, " (format (str "An Oxford comma list of %s, "
"%s, " "%s, "
"and %s.") "and %s.")
@ -156,7 +160,7 @@
street-address ", " city ", " state)) street-address ", " city ", " state))
]}] ]}]
["15_refs" {"__" ["hello" ["16_refs" {"__" ["hello"
"hello" "hello"
"better" "better"
"better!!!" "better!!!"
@ -165,7 +169,7 @@
] ]
"___" [(fn [x] (+ 20 x))]}] "___" [(fn [x] (+ 20 x))]}]
["16_atoms" {"__" [0 ["17_atoms" {"__" [0
1 1
(swap! atomic-clock (partial + 4)) (swap! atomic-clock (partial + 4))
20 20
@ -173,7 +177,7 @@
atomic-clock 20 :fin atomic-clock 20 :fin
]}] ]}]
["17_macros" {"__" [~(first form) ["18_macros" {"__" [~(first form)
~(nth form 2) ~(nth form 2)
form form
(drop 2 form) (drop 2 form)
@ -183,7 +187,7 @@
'(* 10 2) '(* 10 2)
'(+ 10 (2 * 3))]}] '(+ 10 (2 * 3))]}]
["18_datatypes" {"__" [(print ["19_datatypes" {"__" [(print
(str "You're really the " (str "You're really the "
(.category this) (.category this)
", " recipient "... sorry.")) ", " recipient "... sorry."))
@ -195,7 +199,7 @@
(str "Congratulations on your Best Picture Oscar, " (str "Congratulations on your Best Picture Oscar, "
"Evil Alien Conquerors!")]}] "Evil Alien Conquerors!")]}]
["19_java_interop" {"__" [java.lang.String ["20_java_interop" {"__" [java.lang.String
"SELECT * FROM" "SELECT * FROM"
10 10
1024 1024
@ -203,14 +207,14 @@
"___" [#(.toUpperCase %) "___" [#(.toUpperCase %)
] ]
}] }]
["20_partition" {"__" [partition ["21_partition" {"__" [partition
[:a :b :c] [:a :b :c]
'((0 1 2) (3 4)) '((0 1 2) (3 4))
5 5
:hello :hello
(6 :these :are) (6 :these :are)
]}] ]}]
["21_group_by" {"__" [odd? ["22_group_by" {"__" [odd?
{5 ["hello" "world"] 3 ["foo" "bar"]} {5 ["hello" "world"] 3 ["foo" "bar"]}
{1 [{:name "Bob" :id 1} {1 [{:name "Bob" :id 1}
{:last-name "Smith" :id 1}] {:last-name "Smith" :id 1}]
@ -219,7 +223,7 @@
{:naughty-list [{:name "Jimmy" :bad true} {:naughty-list [{:name "Jimmy" :bad true}
{:name "Joe" :bad true}] {:name "Joe" :bad true}]
:nice-list [{:name "Jane" :bad false}]}]}] :nice-list [{:name "Jane" :bad false}]}]}]
["22_meta" {"__" [{:league "National League"} ["23_meta" {"__" [{:league "National League"}
{:division "West"} {:division "West"}
"This doesn't implement the IObj interface" "This doesn't implement the IObj interface"
{:foo :bar} {:foo :bar}

4
src/koans/02_strings.clj Normal file
View File

@ -0,0 +1,4 @@
(ns koans.02-strings
(:require [koan-engine.core :refer :all]))
(meditations)

View File

@ -1,4 +1,4 @@
(ns koans.02-lists (ns koans.03-lists
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations
@ -43,4 +43,3 @@
(rest '()) (rest '())
(catch IllegalStateException e (catch IllegalStateException e
"No dice!")))) "No dice!"))))

View File

@ -1,4 +1,4 @@
(ns koans.03-vectors (ns koans.04-vectors
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.04-sets (ns koans.05-sets
(:require [koan-engine.core :refer :all] (:require [koan-engine.core :refer :all]
[clojure.set :as set])) [clojure.set :as set]))

View File

@ -1,4 +1,4 @@
(ns koans.05-maps (ns koans.06-maps
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.06-functions (ns koans.07-functions
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn multiply-by-ten [n] (defn multiply-by-ten [n]

View File

@ -1,4 +1,4 @@
(ns koans.07-conditionals (ns koans.08-conditionals
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn explain-exercise-velocity [exercise-term] (defn explain-exercise-velocity [exercise-term]

View File

@ -1,4 +1,4 @@
(ns koans.08-higher-order-functions (ns koans.09-higher-order-functions
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.09-runtime-polymorphism (ns koans.10-runtime-polymorphism
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn hello (defn hello

View File

@ -1,4 +1,4 @@
(ns koans.10-lazy-sequences (ns koans.11-lazy-sequences
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.11-sequence-comprehensions (ns koans.12-sequence-comprehensions
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.12-creating-functions (ns koans.13-creating-functions
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn square [x] (* x x)) (defn square [x] (* x x))

View File

@ -1,4 +1,4 @@
(ns koans.13-recursion (ns koans.14-recursion
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn is-even? [n] (defn is-even? [n]

View File

@ -1,4 +1,4 @@
(ns koans.14-destructuring (ns koans.15-destructuring
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(def test-address (def test-address

View File

@ -1,4 +1,4 @@
(ns koans.15-refs (ns koans.16-refs
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(def the-world (ref "hello")) (def the-world (ref "hello"))

View File

@ -1,4 +1,4 @@
(ns koans.16-atoms (ns koans.17-atoms
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(def atomic-clock (atom 0)) (def atomic-clock (atom 0))

View File

@ -1,4 +1,4 @@
(ns koans.17-macros (ns koans.18-macros
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defmacro hello [x] (defmacro hello [x]

View File

@ -1,4 +1,4 @@
(ns koans.18-datatypes (ns koans.19-datatypes
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defrecord Nobel [prize]) (defrecord Nobel [prize])

View File

@ -1,4 +1,4 @@
(ns koans.19-java-interop (ns koans.20-java-interop
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.20-partition (ns koans.21-partition
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(meditations (meditations

View File

@ -1,4 +1,4 @@
(ns koans.21-group-by (ns koans.22-group-by
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(defn get-odds-and-evens [coll] (defn get-odds-and-evens [coll]

View File

@ -1,4 +1,4 @@
(ns koans.22-meta (ns koans.23-meta
(:require [koan-engine.core :refer :all])) (:require [koan-engine.core :refer :all]))
(def giants (def giants