From e96ccc44943a768fb2b9a13ae1fc029884ba796f Mon Sep 17 00:00:00 2001 From: Kyle VanderBeek Date: Tue, 3 Dec 2013 11:19:52 -0800 Subject: [PATCH] Switch variable from index to x to avoid confusing syntax highlightig. index is a clojure.set function and ended up highlighted for me, sending me down a rabbit hole of confusion. Avoid this with a more generic variable name consistent with other Koan files. --- src/koans/11_sequence_comprehensions.clj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/koans/11_sequence_comprehensions.clj b/src/koans/11_sequence_comprehensions.clj index 43ca49e..c635dfa 100644 --- a/src/koans/11_sequence_comprehensions.clj +++ b/src/koans/11_sequence_comprehensions.clj @@ -1,27 +1,27 @@ (meditations "Sequence comprehensions can bind each element in turn to a symbol" (= __ - (for [index (range 6)] - index)) + (for [x (range 6)] + x)) "They can easily emulate mapping" (= '(0 1 4 9 16 25) - (map (fn [index] (* index index)) + (map (fn [x] (* x x)) (range 6)) - (for [index (range 6)] + (for [x (range 6)] __)) "And also filtering" (= '(1 3 5 7 9) (filter odd? (range 10)) - (for [index __ :when (odd? index)] - index)) + (for [x __ :when (odd? x)] + x)) "Combinations of these transformations is trivial" (= '(1 9 25 49 81) - (map (fn [index] (* index index)) + (map (fn [x] (* x x)) (filter odd? (range 10))) - (for [index (range 10) :when __] + (for [x (range 10) :when __] __)) "More complex transformations simply take multiple binding forms"