Share your thoughts in the 2024 State of Clojure Survey!

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

0 votes
in Clojure by

Rich mentioned in IRC today he'd welcome a reducer implementation of clojure.core/range. Now that I've figured out how to do iterate, I figure I'll knock out range as well by the end of the night. Just opening the issue early to announce my intentions to anyone else interested in doing it.

24 Answers

0 votes
by

Comment made by: jasonjckn

Should r/range return something Seqable and Counted?

If so, I'll do the same for r/repeat.

0 votes
by

Comment made by: amalloy

I've sketched out a description of the issues and options. I'm not very familiar with the dev wiki and couldn't figure out where was the right place to put this. "release.next" seems to still be about 1.4 issues, and I don't know if it's "appropriate" to create a whole new category for this. It's available (link: https://gist.github.com/1586b2460329dde1c374 text: as a gist) until a better home can be found for it.

0 votes
by

Comment made by: amalloy

Here's a single patch summing up the state Rich suggested "rolling back" to: separate r/range and r/iterate functions. I haven't heard any feedback since doing the writeup Rich asked for, so am not making any further progress at the moment; if something other than this patch is desired just let me know.

0 votes
by

Comment made by: richhickey

I prefer not to see the use of extend like this for new types. Perhaps this code is too DRY? Also, it does a lot in one patch which makes it hard to parse and accept. This adds Range, switches impl of vector folds etc. Can it be broken up into separate tickets that do each step that builds on the previous, e.g. one ticket could be: capture vector fold impl for reuse by similar things.

0 votes
by

Comment made by: amalloy

Okay, I should be able to split it up over the weekend. I'll also see about converting fold-by-halves into a function that is used by Range/Vector, rather than a function that gets extended onto them.

0 votes
by

Comment made by: amalloy

As requested, I have split up the large patch on this issue into four smaller tickets. The other three are: CLJ-1045, CLJ-1046, and CLJ-992.

CLJ-1045 contains the implementation of fold-by-halves, and as such this patch cannot be applied until CLJ-1045 is accepted. This ticket does not depend on the other two, but there will be minor merge conflicts if this is merged before them.

0 votes
by

Comment made by: gshayban

range is now reducible.

0 votes
by

Comment made by: gshayban

We should close this too. The only thing not covered in 1.7 is the foldable aspect.

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