File tree Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Expand file tree Collapse file tree 2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -8944,11 +8944,13 @@ reduces them without incurring seq initialization"
8944
8944
(es6-iterable Eduction)
8945
8945
8946
8946
(defn eduction
8947
- " Returns a reducible/iterable/seqable application of
8948
- the transducer to the items in coll. Note that these applications
8949
- will be performed every time iterator/seq/reduce is called."
8950
- [xform coll]
8951
- (Eduction. xform coll))
8947
+ " Returns a reducible/iterable application of the transducers
8948
+ to the items in coll. Transducers are applied in order as if
8949
+ combined with comp. Note that these applications will be
8950
+ performed every time reduce/iterator is called."
8951
+ {:arglists '([xform* coll])}
8952
+ [& xforms]
8953
+ (Eduction. (apply comp (butlast xforms)) (last xforms)))
8952
8954
8953
8955
(defn run!
8954
8956
" Runs the supplied procedure (via reduce), for purposes of side
Original file line number Diff line number Diff line change 1369
1369
(is (= (sequence (mapcat reverse) [[3 2 1 0 ] [6 5 4 ] [9 8 7 ]])
1370
1370
(range 10 )))
1371
1371
(is (= (seq (eduction (map inc) [1 2 3 ])) '(2 3 4 )))
1372
+ (is (= (seq (eduction (map inc) (map inc) [1 2 3 ])) '(3 4 5 )))
1372
1373
(is (= (sequence (partition-by #{:split }) [1 2 3 :split 4 5 6 ])
1373
1374
'([1 2 3 ] [:split ] [4 5 6 ])))
1374
1375
(is (= (sequence (partition-all 3 ) '(1 2 3 4 5 ))
You can’t perform that action at this time.
0 commit comments