Skip to content
This repository
Browse code

Reformatting for consistency

  • Loading branch information...
commit 3cca560b96369a96c5f021f86bf4977b858a40b9 1 parent dd23270
Aaron Bedra authored October 25, 2011
3  src/koans/atoms.clj
@@ -27,5 +27,4 @@
27 27
   "When your expectations are aligned with reality things, proceed that way"
28 28
   (= :fin (do
29 29
             (compare-and-set! __ __ __)
30  
-            @atomic-clock))
31  
-  )
  30
+            @atomic-clock)))
17  src/koans/conditionals.clj
@@ -10,21 +10,21 @@
10 10
 (meditations
11 11
   "You will face many decisions"
12 12
   (= __ (if (false? (= 4 5))
13  
-            :a
14  
-            :b))
  13
+          :a
  14
+          :b))
15 15
 
16 16
   "Some of them leave you no alternative"
17 17
   (= __ (if (> 4 3)
18  
-            []))
  18
+          []))
19 19
 
20 20
   "And in such a situation you may have nothing"
21 21
   (= __ (if (nil? 0)
22  
-             [:a :b :c]))
  22
+          [:a :b :c]))
23 23
 
24 24
   "In others your alternative may be interesting"
25 25
   (= :glory (if (not (empty? ()))
26  
-                :doom
27  
-                __))
  26
+              :doom
  27
+              __))
28 28
 
29 29
   "You may have a multitude of possible paths"
30 30
   (let [x 5]
@@ -34,8 +34,8 @@
34 34
 
35 35
   "Or your fate may be sealed"
36 36
   (= __ (if-not (zero? __)
37  
-                'doom
38  
-                'doom))
  37
+          'doom
  38
+          'doom))
39 39
 
40 40
   "In case of emergency, sound the alarms"
41 41
   (= :sirens
@@ -44,4 +44,3 @@
44 44
   "But admit it when you don't know what to do"
45 45
   (= __
46 46
      (explain-defcon-level :yo-mama)))
47  
-
12  src/koans/creating_functions.clj
... ...
@@ -1,15 +1,14 @@
1 1
 (defn square [x] (* x x))
2 2
 
3 3
 (meditations
4  
-
5 4
   "One may know what they seek by knowing what they do not seek"
6 5
   (= [__ __ __] (let [not-a-symbol? (complement symbol?)]
7 6
                   (map not-a-symbol? [:a 'b "c"])))
8 7
 
9 8
   "Praise and 'complement' may help you separate the wheat from the chaff"
10 9
   (= [:wheat "wheat" 'wheat]
11  
-    (let [not-nil? ___]
12  
-      (filter not-nil? [nil :wheat nil "wheat" nil 'wheat nil])))
  10
+       (let [not-nil? ___]
  11
+         (filter not-nil? [nil :wheat nil "wheat" nil 'wheat nil])))
13 12
 
14 13
   "Partial functions allow procrastination"
15 14
   (= 20 (let [multiply-by-5 (partial * 5)]
@@ -17,8 +16,8 @@
17 16
 
18 17
   "Don't forget: first things first"
19 18
   (= [__ __ __ __]
20  
-     (let [ab-adder (partial concat [:a :b])]
21  
-       (ab-adder [__ __])))
  19
+       (let [ab-adder (partial concat [:a :b])]
  20
+         (ab-adder [__ __])))
22 21
 
23 22
   "Functions can join forces as one 'composed' function"
24 23
   (= 25 (let [inc-and-square (comp square inc)]
@@ -30,5 +29,4 @@
30 29
 
31 30
   "Be careful about the order in which you mix your functions"
32 31
   (= 99 (let [square-and-dec ___]
33  
-           (square-and-dec 10))))
34  
-
  32
+          (square-and-dec 10))))
1  src/koans/datatypes.clj
@@ -42,4 +42,3 @@
42 42
   "Surely we can implement our own by now"
43 43
   (= "You're really the Worst Picture, Final Destination 5... sorry."
44 44
      (with-out-str (present (Razzie. "Worst Picture") "Final Destination 5"))))
45  
-
13  src/koans/destructuring.clj
@@ -6,19 +6,19 @@
6 6
 (meditations
7 7
   "Destructuring is an arbiter: it breaks up arguments"
8 8
   (= __ ((fn [[a b]] (str b a))
9  
-           [:foo :bar]))
  9
+         [:foo :bar]))
10 10
 
11 11
   "Whether in function definitions"
12 12
   (= (str "First comes love, "
13 13
           "then comes marriage, "
14 14
           "then comes Clojure with the baby carriage")
15 15
      ((fn [[a b c]] __)
16  
-       ["love" "marriage" "Clojure"]))
  16
+      ["love" "marriage" "Clojure"]))
17 17
 
18 18
   "Or in let expressions"
19 19
   (= "Rich Hickey aka The Clojurer aka Go Time aka Macro Killah"
20 20
      (let [[first-name last-name & aliases]
21  
-             (list "Rich" "Hickey" "The Clojurer" "Go Time" "Macro Killah")]
  21
+           (list "Rich" "Hickey" "The Clojurer" "Go Time" "Macro Killah")]
22 22
        __))
23 23
 
24 24
   "You can regain the full argument if you like arguing"
@@ -29,14 +29,13 @@
29 29
   "Break up maps by key"
30 30
   (= "123 Test Lane, Testerville, TX"
31 31
      (let [{street-address :street-address, city :city, state :state} test-address]
32  
-            __))
  32
+       __))
33 33
 
34 34
   "Or more succinctly"
35 35
   (= "123 Test Lane, Testerville, TX"
36 36
      (let [{:keys [street-address __ __]} test-address]
37  
-            __))
  37
+       __))
38 38
 
39 39
   "All together now!"
40 40
   (= "Test Testerson, 123 Test Lane, Testerville, TX"
41  
-     (___ ["Test" "Testerson"] test-address))
42  
-)
  41
+     (___ ["Test" "Testerson"] test-address)))
6  src/koans/functions.clj
@@ -18,12 +18,12 @@
18 18
 
19 19
   "One function can beget another"
20 20
   (= __ ((fn []
21  
-            ((fn [a b] (__ a b))
22  
-              4 5))))
  21
+           ((fn [a b] (__ a b))
  22
+            4 5))))
23 23
 
24 24
   "Higher-order functions take function arguments"
25 25
   (= 25 (___
26  
-          (fn [n] (* n n))))
  26
+         (fn [n] (* n n))))
27 27
 
28 28
   "But they are often better written using the names of functions"
29 29
   (= 25 (___ square)))
18  src/koans/macros.clj
@@ -11,17 +11,16 @@
11 11
 
12 12
 (defmacro r-infix [form]
13 13
   (cond (not (seq? form))
14  
-          __
  14
+        __
15 15
         (= 1 (count form))
16  
-          `(r-infix ~(first form))
  16
+        `(r-infix ~(first form))
17 17
         :else
18  
-          (let [operator (second form)
19  
-                first-arg (first form)
20  
-                others __]
21  
-            `(~operator
22  
-              (r-infix ~first-arg)
23  
-              (r-infix ~others)))))
24  
-
  18
+        (let [operator (second form)
  19
+              first-arg (first form)
  20
+              others __]
  21
+          `(~operator
  22
+            (r-infix ~first-arg)
  23
+            (r-infix ~others)))))
25 24
 
26 25
 (meditations
27 26
   "Macros are like functions created at compile time"
@@ -41,4 +40,3 @@
41 40
 
42 41
   "Really, you dont understand recursion until you understand recursion"
43 42
   (= 36 (r-infix (10 + (2 * 3) + (4 * 5)))))
44  
-
1  src/koans/maps.clj
@@ -48,4 +48,3 @@
48 48
   "Or the values"
49 49
   (= (list "Sochi" "Torino" __)
50 50
      (sort (vals {2006 "Torino" 2010 "Vancouver" 2014 "Sochi"}))))
51  
-
8  src/koans/recursion.clj
... ...
@@ -1,14 +1,14 @@
1 1
 (defn is-even? [n]
2 2
   (if (= n 0)
3  
-      __
4  
-      (___ (is-even? (dec n)))))
  3
+    __
  4
+    (___ (is-even? (dec n)))))
5 5
 
6 6
 (defn is-even-bigint? [n]
7 7
   (loop [n   n
8 8
          acc true]
9 9
     (if (= n 0)
10  
-        __
11  
-        (recur (dec n) (not acc)))))
  10
+      __
  11
+      (recur (dec n) (not acc)))))
12 12
 
13 13
 (defn recursive-reverse [coll]
14 14
   __)
21  src/koans/refs.clj
@@ -16,14 +16,14 @@
16 16
   "Alter where you need not replace"
17 17
   (= __ (let [exclamator (fn [x] (str x "!"))]
18 18
           (dosync
19  
-            (alter the-world exclamator)
20  
-            (alter the-world exclamator)
21  
-            (alter the-world exclamator))
  19
+           (alter the-world exclamator)
  20
+           (alter the-world exclamator)
  21
+           (alter the-world exclamator))
22 22
           @the-world))
23 23
 
24 24
   "Don't forget to do your work in a transaction!"
25 25
   (= 0 (do __
26  
-         @the-world))
  26
+           @the-world))
27 27
 
28 28
   "Functions passed to alter may depend on the data in the ref"
29 29
   (= 20 (do
@@ -31,10 +31,9 @@
31 31
 
32 32
   "Two worlds are better than one"
33 33
   (= ["Real Jerry" "Bizarro Jerry"]
34  
-     (do
35  
-       (dosync
36  
-         (ref-set the-world {})
37  
-         (alter the-world assoc :jerry "Real Jerry")
38  
-         (alter bizarro-world assoc :jerry "Bizarro Jerry")
39  
-         __))))
40  
-
  34
+       (do
  35
+         (dosync
  36
+          (ref-set the-world {})
  37
+          (alter the-world assoc :jerry "Real Jerry")
  38
+          (alter bizarro-world assoc :jerry "Bizarro Jerry")
  39
+          __))))
4  src/koans/sequence_comprehensions.clj
@@ -28,5 +28,5 @@
28 28
   (= [[:top :left] [:top :middle] [:top :right]
29 29
       [:middle :left] [:middle :middle] [:middle :right]
30 30
       [:bottom :left] [:bottom :middle] [:bottom :right]]
31  
-     (for [row [:top :middle :bottom] column [:left :middle :right]]
32  
-          __)))
  31
+       (for [row [:top :middle :bottom] column [:left :middle :right]]
  32
+         __)))
1  src/koans/sets.clj
@@ -16,4 +16,3 @@
16 16
 
17 17
   "But don't forget about the difference"
18 18
   (= __ (clojure.set/difference #{1 2 3 4 5} #{2 3 5})))
19  
-

0 notes on commit 3cca560

Please sign in to comment.
Something went wrong with that request. Please try again.