IterTools.jl
IterTools.jl copied to clipboard
Feature request: "row-major" product()
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?