On 14/12/11 9:21 PM, Timon Gehr wrote:
On 12/14/2011 09:14 PM, Justin Whear wrote:
I've looked through std.algorithm and std.range, but haven't found
anything
to compute the Cartesian product of several ranges. I have the nagging
feeling that this can be accomplished by combining several
I've looked through std.algorithm and std.range, but haven't found anything
to compute the Cartesian product of several ranges. I have the nagging
feeling that this can be accomplished by combining several of the range
transformations in the standard library.
What I'm after is something like
Justin Whear:
alias Tuple!(int, string) P;
assert(equal(
cartesianProduct([1, 2], [a, b]),
[ P(1, a), P(1, b), P(2, a), P(2, b) ]
));
See std.range.lockstep and std.range.zip.
Bye,
bearophile
On Wed, Dec 14, 2011 at 21:14, Justin Whear jus...@economicmodeling.com wrote:
I've looked through std.algorithm and std.range, but haven't found anything
to compute the Cartesian product of several ranges. I have the nagging
feeling that this can be accomplished by combining several
See std.range.lockstep and std.range.zip.
This suggestion was wrong, sorry.
There is a need for a product in std.range, I think.
Bye,
bearophile
On 12/14/2011 09:14 PM, Justin Whear wrote:
I've looked through std.algorithm and std.range, but haven't found anything
to compute the Cartesian product of several ranges. I have the nagging
feeling that this can be accomplished by combining several of the range
transformations in the standard