Skip to content

fix transducer composition problems, add tests#510

Merged
thomasmulvaney merged 1 commit intopixie-lang:masterfrom
notnew:master
Mar 15, 2016
Merged

fix transducer composition problems, add tests#510
thomasmulvaney merged 1 commit intopixie-lang:masterfrom
notnew:master

Conversation

@notnew
Copy link

@notnew notnew commented Mar 13, 2016

Remove preserving-reduced from several transducers. This was modifying
the reducing function passed to the transducer, causing reduced values
to be wrapped in reduced twice, so the reducing process wasn't
completely unwrapping reduced values when
finishing. Reducing functions only need to be wrapped with
preserving-reduced if they call reduce themselves. (Like cat and
pixie.io.common/stream-reducer)

For example

(transduce (comp (drop 1) (take 2)) conj [1 2 3 4])

would not return the expected result of [2 3]

Also fixes a problem with the take transducer consuming one more
element than needed.

Add tests for these problems.

remove `preserving-reduced` from several transducers. This was modifying
the reducing function passed to the transducer, causing reduced values
to be wrapped in `reduced` twice, so the reducing process wasn't
completely unwrapping reduced values when
finishing. Reducing functions only need to be wrapped with
`preserving-reduced` if they call `reduce` themselves. (Like `cat` and
`pixie.io.common/stream-reducer`)

Also fixes a problem with the `take` transducer consuming one more
element than needed.

Add tests for these problems.
thomasmulvaney added a commit that referenced this pull request Mar 15, 2016
fix transducer composition problems, add tests
@thomasmulvaney thomasmulvaney merged commit 828ae0b into pixie-lang:master Mar 15, 2016
@thomasmulvaney
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants