Hello all,

I found an edge case where stateful transducers in core differ in
whether they reset or clear state in the completion arity
(partition-all) or don’t (take).

Given the two transformed reducing functions

    (def conj-partitioning-all-3 ((partition-all 3) conj))
    (def conj-taking-3 ((take 3) conj))

when performing transduction with those reducing functions twice in a
row, one yields the same result twice, the other doesn’t.

    (transduce identity conj-partitioning-all-3 [] (range 10))
    ;; => [[0 1 2] [3 4 5] [6 7 8] [9]]
    ;; => [[0 1 2] [3 4 5] [6 7 8] [9]]

    (transduce identity conj-taking-3 [] (range 10))
    ;; => [0 1 2]
    ;; => []

Question: which behaviour is the one I should emulate in my own
transducers?

Thank you,
David

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to