Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.

Commit 39b913b

Browse files
author
David Orme
committed
Fixed pipe bug with reducer and initial value
1 parent 4843c82 commit 39b913b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/bradsdeals/pipe.clj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,13 +96,13 @@ collection elements specify the initial two elements in the reduction. The redu
9696
supports the 'reduced' function in the standard library so that a single input
9797
collection can produce multiple reduced outputs.
9898
99-
* A map containing an arity 2 function and a second value treats the function as
99+
* A vector containing an arity 2 function and a second value treats the function as
100100
a reducer and the second value as the initial value in the reduction.
101101
102102
The input is processed through fns, a single element at a time, without creating
103103
intermediate collections, in the order in which fns are specified."
104104
[input & fns]
105-
(let [input (if (or (map? input) (sequential? input)) input [input])
105+
(let [input (if (or (vector? input) (sequential? input)) input [input])
106106
composed-fns (fns->transducer fns)]
107107
(sequence composed-fns input)))
108108

@@ -172,5 +172,3 @@ container match, the same container will be returned multiple time."
172172
(v/tree-visitor (v/tree-zipper node) [] [(grep-tree-visitor pattern)])))
173173
([pattern]
174174
(partial grep pattern)))
175-
176-

0 commit comments

Comments
 (0)