Skip to content

Commit 4db4b2f

Browse files
committed
add new for comprehension example with :let
1 parent e81b8d3 commit 4db4b2f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/documentation/control-flow.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ have the form `:modifier argument`. The following modifiers are supported:
146146
(for [[k v] :pairs [1 2 3]] [k v]) # Evaluates to [[0 1] [1 2] [2 3]]
147147
(for [[k v] :pairs {:a 1 :b 2 :c 3} :reduce [m {}]]
148148
(put m k (inc v))) # Evaluates to {:a 2 :b 3 :c 4}
149+
(for [[k v] :pairs {:a 1 :b 2 :c 3} :reduce [m {}] :let [x (inc v)]]
150+
(put m k x)) # Evaluates to {:a 2 :b 3 :c 4}
149151
150152
(for [x :in [2 2 2 3 3 4 5 6 6] :while (even? x)] x) # Evaluates to [2 2 2]
151153
(for [x :in [2 2 2 3 3 4 5 6 6] :when (even? x)] x) # Evaluates to [2 2 2 4 6 6]

0 commit comments

Comments
 (0)