Affects versions: 1.9.908
Fix versions: None
Patch:Code and Test
Have iterate, cycle, and repeat return custom types that are directly reducible.
Background and inspiration are CLJ-1603 Closed and http://insideclojure.org/2015/01/18/reducible-generators/
While (satisfies? IReduce (iterate inc 0)) returns true this is via LazySeq, as opposed to, for example (satisfies? IReduce (range)) which involves a custom type.
One motivation would be the ability to transduce over large generated collections without consuming memory (which otherwise occurs due to lack of locals clearing).
For example, the following uses very little memory:
where this semantically equivalent form consumes gigabytes:
It is expected that, to implement this ticket, three new types would be introduced, akin to the existing Range class, porting as much as possible from the existing types implemented in Clojure for iterate, cycle, and repeat.