Short start on destructuring.
This commit is contained in:
		@@ -4,7 +4,6 @@ immutability/side effects
 | 
			
		||||
state identity lifetime
 | 
			
		||||
memoization
 | 
			
		||||
lazy sequences
 | 
			
		||||
recursion
 | 
			
		||||
recursive list processing
 | 
			
		||||
trampolining
 | 
			
		||||
reflection
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								src/koans/destructuring.clj
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								src/koans/destructuring.clj
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
(meditations
 | 
			
		||||
  "Destructuring allows you to break up arguments"
 | 
			
		||||
  (= __ ((fn [[a b]] (str b a))
 | 
			
		||||
           [:foo :bar])))
 | 
			
		||||
@@ -94,6 +94,7 @@
 | 
			
		||||
                         (if (zero? n)
 | 
			
		||||
                             acc
 | 
			
		||||
                             (recur (dec n) (* acc n))))]}
 | 
			
		||||
   "destructuring" {"__" ["\":bar:foo\""]}
 | 
			
		||||
   })
 | 
			
		||||
 | 
			
		||||
(defn replace-with [s k replacements]
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,8 @@
 | 
			
		||||
      "runtime_polymorphism"
 | 
			
		||||
      "sequence_comprehensions"
 | 
			
		||||
      "partial_functions"
 | 
			
		||||
      "recursion"])
 | 
			
		||||
      "recursion"
 | 
			
		||||
      "destructuring"])
 | 
			
		||||
 | 
			
		||||
(defn run []
 | 
			
		||||
  (apply load (doall (map (partial str "koans/") ordered-koans)))
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user