Skip to content

Commit c1a23c8

Browse files
committed
3 arity into
1 parent 0563346 commit c1a23c8

3 files changed

Lines changed: 13 additions & 6 deletions

File tree

pixie/fs.pxi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"Recursively returns all files and directories below")
5353

5454
(walk-files [this]
55-
"Recursivelt returns all files underneath")
55+
"Recursively returns all files underneath")
5656

5757
(walk-dirs [this]
5858
"Recursivley returns all directories underneath"))

pixie/stdlib.pxi

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,14 @@
195195
(def into (fn ^{:doc "Add the elements of `from` to the collection `to`."
196196
:signatures [[to from]]
197197
:added "0.1"}
198-
into
199-
[to from]
200-
(if (satisfies? IToTransient to)
201-
(persistent! (reduce conj! (transient to) from))
202-
(reduce conj to from))))
198+
([to from]
199+
(if (satisfies? IToTransient to)
200+
(persistent! (reduce conj! (transient to) from))
201+
(reduce conj to from)))
202+
([to xform from]
203+
(if (satisfies? IToTransient to)
204+
(transduce xform conj! (transient to) from)
205+
(transduce xform conj to from)))))
203206

204207
(def interpose
205208
(fn ^{:doc "Returns a transducer that inserts `val` in between elements of a collection."

tests/pixie/tests/test-stdlib.pxi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,10 @@
338338
[2 :a] [2 :b] [2 :c]
339339
[3 :a] [3 :b] [3 :c]]))
340340

341+
(t/deftest test-into
342+
(t/assert= [1 3] (into [] (comp (map inc) (filter odd?)) (range 3)))
343+
(t/assert= {:a 1 :b 2} (into {} [[:a 1] [:b 2]])))
344+
341345
(t/deftest test-ex-msg
342346
(try
343347
(throw "This is an exception")

0 commit comments

Comments
 (0)