26
This commit is contained in:
parent
2f1fa3cc3b
commit
ce7411159d
1 changed files with 5 additions and 5 deletions
|
|
@ -10,21 +10,21 @@
|
||||||
|
|
||||||
(meditations
|
(meditations
|
||||||
"A sequence operation with only one argument often returns a transducer"
|
"A sequence operation with only one argument often returns a transducer"
|
||||||
(= __
|
(= '(2 3 4)
|
||||||
(sequence example-transducer [1 2 3]))
|
(sequence example-transducer [1 2 3]))
|
||||||
|
|
||||||
"Consider that sequence operations can be composed as transducers"
|
"Consider that sequence operations can be composed as transducers"
|
||||||
(= __
|
(= [2 4]
|
||||||
(transduce transforms conj [1 2 3]))
|
(transduce transforms conj [1 2 3]))
|
||||||
|
|
||||||
"We can do this eagerly"
|
"We can do this eagerly"
|
||||||
(= __
|
(= [2 4]
|
||||||
(into [] transforms [1 2 3]))
|
(into [] transforms [1 2 3]))
|
||||||
|
|
||||||
"Or lazily"
|
"Or lazily"
|
||||||
(= __
|
(= '(2 4)
|
||||||
(sequence transforms [1 2 3]))
|
(sequence transforms [1 2 3]))
|
||||||
|
|
||||||
"The transduce function can combine mapping and reduction"
|
"The transduce function can combine mapping and reduction"
|
||||||
(= __
|
(= 6
|
||||||
(transduce transforms + [1 2 3])))
|
(transduce transforms + [1 2 3])))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue