Welcome! Please see the About page for a little more info on how this works.

0 votes
in Clojure by

Added a reducer implementation mirroring clojure.core/iterate.

Patch: iterate-reducer.patch

Screened by:

6 Answers

0 votes
by

Comment made by: amalloy

Should I have made this implement Seqable as well? It wasn't clear to me, because as far as I could see this was the only function in clojure.core.reducers that's generating a brand-new sequence rather than transforming an existing one.

0 votes
by

Comment made by: amalloy

Previous version neglected to include the seed value of the iteration in the reduce.

0 votes
by

Comment made by: jasonjckn

Currying iterate seems useless, albeit not harmful.

While implementing repeat, I couldn't use currying. Because 1-arity is already reserved for infinite repeat ((link: n x] and [x], not [n x] and [n) if currying)

How about we just support currying for functions where last param is reducible?

0 votes
by

Comment made by: amalloy

This new patch replaces the previous patch. As requested, I am splitting up the large issue CLJ-993 into smaller tickets.

Does not depend on any of my other reducer patches, but there will probably be some minor merge conflicts unless it is merged after CLJ-1045 and CLJ-1046, and before CLJ-993.

0 votes
by

Comment made by: gshayban

iterate is now reducible

0 votes
by
Reference: https://clojure.atlassian.net/browse/CLJ-992 (reported by amalloy)
Welcome to Clojure Q&A, where you can ask questions and receive answers from members of the Clojure community.
...