2012-06-08 20:01:39 +00:00
|
|
|
[["01_equalities" {"__" [true
|
2011-11-27 19:14:02 +00:00
|
|
|
2
|
|
|
|
5
|
2013-03-04 22:45:55 +00:00
|
|
|
true
|
2011-11-27 19:14:02 +00:00
|
|
|
false
|
2013-03-04 22:45:55 +00:00
|
|
|
true
|
2013-03-04 23:06:46 +00:00
|
|
|
true
|
2013-03-04 23:30:00 +00:00
|
|
|
false
|
2015-07-06 12:28:21 +00:00
|
|
|
"hello"
|
|
|
|
"hello"
|
2016-05-12 15:41:09 +00:00
|
|
|
nil
|
2011-11-27 19:14:02 +00:00
|
|
|
3]}]
|
|
|
|
|
2015-09-13 06:17:47 +00:00
|
|
|
["02_strings" {"__" ["hello"
|
|
|
|
"world"
|
|
|
|
"Cool "
|
|
|
|
"right?"
|
|
|
|
0
|
|
|
|
11
|
|
|
|
false
|
|
|
|
6 11
|
|
|
|
"123"
|
|
|
|
", "
|
|
|
|
"1" "2" "3"
|
|
|
|
"olleh"
|
|
|
|
"hello"
|
|
|
|
13
|
2016-01-25 20:30:57 +00:00
|
|
|
nil
|
2015-09-13 06:17:47 +00:00
|
|
|
"hello world"
|
|
|
|
true
|
|
|
|
false
|
|
|
|
false
|
|
|
|
"a"
|
|
|
|
true
|
|
|
|
true
|
|
|
|
false]}]
|
2015-09-13 05:28:39 +00:00
|
|
|
|
|
|
|
["03_lists" {"__" [1 2 3 4 5
|
2011-11-27 19:14:02 +00:00
|
|
|
1
|
|
|
|
[2 3 4 5]
|
2013-03-04 22:58:58 +00:00
|
|
|
3
|
|
|
|
0
|
2011-11-27 19:14:02 +00:00
|
|
|
()
|
|
|
|
[:a :b :c :d :e]
|
2013-03-04 22:58:58 +00:00
|
|
|
[:e :a :b :c :d]
|
2011-11-27 19:14:02 +00:00
|
|
|
:a
|
|
|
|
[:b :c :d :e]
|
|
|
|
"No dice!"
|
|
|
|
()]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["04_vectors" {"__" [1
|
2011-11-27 19:14:02 +00:00
|
|
|
[1]
|
2013-03-04 23:06:46 +00:00
|
|
|
[nil nil]
|
2011-11-27 19:14:02 +00:00
|
|
|
2
|
2013-03-04 23:10:04 +00:00
|
|
|
[111 222 333]
|
2011-11-27 19:14:02 +00:00
|
|
|
:peanut
|
|
|
|
:jelly
|
|
|
|
:jelly
|
|
|
|
[:butter :and]
|
|
|
|
3]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["05_sets" {"__" [[3]
|
2011-11-27 19:14:02 +00:00
|
|
|
3
|
|
|
|
#{1 2 3 4 5}
|
|
|
|
#{1 2 3 4 5}
|
|
|
|
#{2 3}
|
|
|
|
#{1 4}]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["06_maps" {"__" [:b 2
|
2011-11-27 19:14:02 +00:00
|
|
|
1
|
|
|
|
2
|
|
|
|
2
|
|
|
|
1
|
|
|
|
1
|
2014-11-26 22:01:18 +00:00
|
|
|
"Sochi"
|
2011-11-27 19:14:02 +00:00
|
|
|
nil
|
|
|
|
:key-not-found
|
|
|
|
true
|
|
|
|
false
|
|
|
|
"February"
|
|
|
|
1 "January"
|
2017-05-10 13:32:25 +00:00
|
|
|
:c 3
|
2016-10-02 08:54:58 +00:00
|
|
|
2
|
2015-06-14 18:02:12 +00:00
|
|
|
2010 2014 2018
|
2016-10-02 08:54:58 +00:00
|
|
|
"PyeongChang" "Sochi" "Vancouver"
|
|
|
|
2 3]}]
|
2012-06-08 20:01:39 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["07_functions" {"__" [81
|
2013-03-04 23:51:31 +00:00
|
|
|
20
|
|
|
|
10
|
|
|
|
60
|
2013-07-22 17:10:37 +00:00
|
|
|
15
|
2017-05-10 13:32:25 +00:00
|
|
|
"AACC"]
|
2013-03-04 23:51:31 +00:00
|
|
|
"___" [+
|
|
|
|
*
|
|
|
|
(fn [f] (f 5))
|
2011-11-27 19:14:02 +00:00
|
|
|
(fn [f] (f 5))]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["08_conditionals" {"__" [:a
|
2011-11-27 19:14:02 +00:00
|
|
|
[]
|
|
|
|
nil
|
|
|
|
:glory
|
|
|
|
4 6 :your-road
|
2013-11-22 19:52:20 +00:00
|
|
|
1
|
2015-07-06 12:28:21 +00:00
|
|
|
:bicycling
|
|
|
|
"is that even exercise?"]}]
|
2011-11-27 19:14:02 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["09_higher_order_functions" {"__" [4 8 12
|
2011-11-27 19:14:02 +00:00
|
|
|
(* x x)
|
|
|
|
[false false true false false]
|
|
|
|
()
|
|
|
|
[:anything :goes :here]
|
|
|
|
(< x 31)
|
|
|
|
(* 10 x) (< x 4)
|
|
|
|
24
|
|
|
|
100
|
|
|
|
(count a) (count b)]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["10_runtime_polymorphism" {"__" [(str (:name a) " eats veggies.")
|
2011-11-27 19:14:02 +00:00
|
|
|
(str (:name a) " eats animals.")
|
|
|
|
(str "I don't know what " (:name a) " eats.")
|
|
|
|
"Hello World!"
|
|
|
|
"Hello, you silly world."
|
|
|
|
"Hello to this group: Peter, Paul, Mary!" ]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["11_lazy_sequences" {"__" [[1 2 3 4]
|
2011-11-27 19:14:02 +00:00
|
|
|
[0 1 2 3 4]
|
|
|
|
10
|
|
|
|
95
|
|
|
|
(range 20)
|
|
|
|
:a]
|
2013-11-23 02:54:26 +00:00
|
|
|
"___" [(fn [x] x)]}]
|
2011-11-27 19:14:02 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["12_sequence_comprehensions" {"__" [[0 1 2 3 4 5]
|
2014-01-21 13:42:52 +00:00
|
|
|
(* x x)
|
2011-11-27 19:14:02 +00:00
|
|
|
(range 10)
|
2014-01-21 13:42:52 +00:00
|
|
|
(odd? x) (* x x)
|
2011-11-27 19:14:02 +00:00
|
|
|
[row column]
|
|
|
|
]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["13_creating_functions" {"__" [true false true
|
2011-11-27 19:14:02 +00:00
|
|
|
4
|
|
|
|
:a :b :c :d
|
|
|
|
:c :d
|
|
|
|
4
|
|
|
|
8]
|
|
|
|
"___" [(complement nil?)
|
|
|
|
multiply-by-5
|
|
|
|
(comp dec square)]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["14_recursion" {"__" [true
|
2011-11-27 19:14:02 +00:00
|
|
|
acc
|
|
|
|
(loop [coll coll
|
|
|
|
acc ()]
|
|
|
|
(if (seq coll)
|
|
|
|
(recur (rest coll) (conj acc (first coll)))
|
|
|
|
acc))
|
|
|
|
(loop [n n
|
|
|
|
acc 1]
|
|
|
|
(if (zero? n)
|
|
|
|
acc
|
|
|
|
(recur (dec n) (* acc n))))]
|
|
|
|
"___" [not]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["15_destructuring" {"__" [":bar:foo"
|
2015-07-06 12:28:21 +00:00
|
|
|
(format (str "An Oxford comma list of %s, "
|
|
|
|
"%s, "
|
|
|
|
"and %s.")
|
2011-11-27 19:14:02 +00:00
|
|
|
a b c)
|
|
|
|
(apply str
|
|
|
|
(interpose " "
|
|
|
|
(apply list
|
|
|
|
first-name
|
|
|
|
last-name
|
|
|
|
(interleave (repeat "aka") aliases))))
|
|
|
|
{:original-parts full-name
|
|
|
|
:named-parts {:first first-name :last last-name}}
|
|
|
|
(str street-address ", " city ", " state)
|
|
|
|
city state
|
|
|
|
(str street-address ", " city ", " state)]
|
|
|
|
"___" [(fn [[fname lname]
|
|
|
|
{:keys [street-address city state]}]
|
|
|
|
(str fname " " lname ", "
|
|
|
|
street-address ", " city ", " state))
|
|
|
|
]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["16_refs" {"__" ["hello"
|
2011-11-27 19:14:02 +00:00
|
|
|
"hello"
|
|
|
|
"better"
|
|
|
|
"better!!!"
|
|
|
|
(dosync (ref-set the-world 0))
|
|
|
|
(map :jerry [@the-world @bizarro-world])
|
|
|
|
]
|
|
|
|
"___" [(fn [x] (+ 20 x))]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["17_atoms" {"__" [0
|
2011-11-27 19:14:02 +00:00
|
|
|
1
|
|
|
|
(swap! atomic-clock (partial + 4))
|
|
|
|
20
|
|
|
|
20
|
|
|
|
atomic-clock 20 :fin
|
|
|
|
]}]
|
|
|
|
|
2016-05-12 15:43:41 +00:00
|
|
|
["18_quote" {"__" ['(1 2 3 4 5)
|
|
|
|
(1 2 3 4 5)
|
|
|
|
'age
|
|
|
|
quote
|
|
|
|
'(+ 2 3)
|
|
|
|
1 2 3
|
|
|
|
1 5]}]
|
2011-11-27 19:14:02 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["19_datatypes" {"__" [(print
|
2011-11-27 19:14:02 +00:00
|
|
|
(str "You're really the "
|
|
|
|
(.category this)
|
|
|
|
", " recipient "... sorry."))
|
|
|
|
"peace"
|
|
|
|
"literature"
|
|
|
|
"physics"
|
|
|
|
nil
|
|
|
|
[true false]
|
|
|
|
(str "Congratulations on your Best Picture Oscar, "
|
|
|
|
"Evil Alien Conquerors!")]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["20_java_interop" {"__" [java.lang.String
|
2011-11-27 19:14:02 +00:00
|
|
|
"SELECT * FROM"
|
|
|
|
10
|
|
|
|
1024
|
|
|
|
]
|
|
|
|
"___" [#(.toUpperCase %)
|
2016-05-12 15:43:41 +00:00
|
|
|
]}]
|
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["21_partition" {"__" [partition
|
2012-08-04 10:11:33 +00:00
|
|
|
[:a :b :c]
|
|
|
|
'((0 1 2) (3 4))
|
|
|
|
5
|
|
|
|
:hello
|
2013-11-22 19:52:20 +00:00
|
|
|
(6 :these :are)
|
2013-09-16 18:42:18 +00:00
|
|
|
]}]
|
2016-05-12 15:43:41 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["22_group_by" {"__" [odd?
|
2013-09-16 18:42:18 +00:00
|
|
|
{5 ["hello" "world"] 3 ["foo" "bar"]}
|
|
|
|
{1 [{:name "Bob" :id 1}
|
|
|
|
{:last-name "Smith" :id 1}]
|
2015-07-06 12:28:21 +00:00
|
|
|
2 [{:name "Jennifer" :id 2}]}
|
2013-09-16 18:42:18 +00:00
|
|
|
nil
|
2014-01-21 14:06:34 +00:00
|
|
|
{:naughty-list [{:name "Jimmy" :bad true}
|
|
|
|
{:name "Joe" :bad true}]
|
2015-07-06 12:28:21 +00:00
|
|
|
:nice-list [{:name "Jane" :bad false}]}]}]
|
2016-05-12 15:43:41 +00:00
|
|
|
|
2015-09-13 05:28:39 +00:00
|
|
|
["23_meta" {"__" [{:league "National League"}
|
2015-07-12 20:03:34 +00:00
|
|
|
{:division "West"}
|
|
|
|
"This doesn't implement the IObj interface"
|
|
|
|
{:foo :bar}
|
|
|
|
nil
|
|
|
|
\C
|
|
|
|
inc
|
|
|
|
:park "AT&T Park"
|
|
|
|
'Giants
|
|
|
|
"Giants"]}]
|
2016-05-12 15:43:41 +00:00
|
|
|
|
|
|
|
["24_macros" {"__" [~(first form)
|
|
|
|
~(nth form 2)
|
|
|
|
form
|
|
|
|
(drop 2 form)
|
|
|
|
"Hello, Macros!"
|
|
|
|
10
|
|
|
|
'(+ 9 1)
|
|
|
|
'(* 10 2)
|
|
|
|
'(+ 10 (2 * 3))]}]
|
|
|
|
|
2013-09-16 18:42:18 +00:00
|
|
|
]
|