JuliaCollections / JuliaCollections/IterTools.jl
Feature request: "row-major" product()
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 160
- Forks
- 30
- PR merge metrics
- No merged PRs in 30d
Description
Currently product() iterates over its parameters in a "column-major" order (I guess, to be consistent with the order of array indices). I believe it would be useful to be able to iterate in a row-major order as well (that is, the first iterable changes the slowest). Of course, one can piggy-back on product, passing it reverse()ed arguments, and reverse()ing back the results of next(), but it makes the iteration several times slower.
Logic-wise, the only thing that will need to change is the iteration in next() — from for i in 1:n to for i in n:-1:1. I am not sure how to handle the eltype() properly. Perhaps a parametrization of Product on a value type is needed?
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the Product implementation, focusing on next() and eltype(). Confirm how the current parameter iteration determines order, then define the row-major behavior so the first iterable changes slowest without using reversed arguments. Done means the iteration order and resulting element type are handled correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100