[Issue 7128] Cartesian product of ranges
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Feb 5 18:26:10 PST 2013
http://d.puremagic.com/issues/show_bug.cgi?id=7128
--- Comment #4 from hsteoh at quickfur.ath.cx 2013-02-05 18:26:05 PST ---
Now that the basic 2-argument case is working, I'll start looking into the
multi-argument case.
The simplest implementation is to just alias the variadic version to the
2-argument version chained to a recursive invocation of itself, but this has
the disadvantage that the resulting range will have nested tuples rather than a
single tuple of multiple values at the top-level.
For the repeated case, I'm thinking that with D's compile-time introspection,
we can probably implement:
auto cartesianPower(int n, R)(R range) { ... }
which returns the cartesian product of n copies of the range with. Or maybe:
auto cartesianProduct(R)(R range, int repeat) { ... }
Don't really know which API is better.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list