summaryrefslogtreecommitdiffhomepage
path: root/clojure.html.markdown
diff options
context:
space:
mode:
authorAdam <adam@adambard.com>2016-10-21 15:35:09 -0700
committerAdam <adam@adambard.com>2016-10-21 15:35:09 -0700
commit620e5d20402be961d27ce6cc6a007204c81391d4 (patch)
treee33427b1aa82c11a8e974ccd8a02b789de4c9737 /clojure.html.markdown
parentde376b4357e79fc847e4c1ae2717946fe05d3bef (diff)
parent0659107a78bddd722df816daa01ee622fb4508d1 (diff)
Merge branch 'master' of github.com:adambard/learnxinyminutes-docs
Diffstat (limited to 'clojure.html.markdown')
-rw-r--r--clojure.html.markdown13
1 files changed, 13 insertions, 0 deletions
diff --git a/clojure.html.markdown b/clojure.html.markdown
index 58e835c9..bf9258f7 100644
--- a/clojure.html.markdown
+++ b/clojure.html.markdown
@@ -289,6 +289,19 @@ keymap ; => {:a 1, :b 2, :c 3}
(into [])) ;=> (into [] (filter odd? (map inc (range 10)))
; Result: [1 3 5 7 9]
+; When you are in a situation where you want more freedom as where to
+; put the result of previous data transformations in an
+; expression, you can use the as-> macro. With it, you can assign a
+; specific name to transformations' output ans use it as a
+; placeholder in your chained expressions:
+
+(as-> [1 2 3] input
+ (map inc input);=> You can use last transform's output at the last position
+ (nth input 4) ;=> and at the second position, in the same expression
+ (conj [4 5 6] input [8 9 10])) ;=> or in the middle !
+
+
+
; Modules
;;;;;;;;;;;;;;;