Dynamic cartesianProduct()

Nordlöw via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Dec 11 07:06:30 PST 2015


Have anybody put together a lazy variant of cartesianProduct() 
that operates on a range of ranges:

Sample call

cartesianProductDynamic([["2", "3"], ["green", "red"], ["apples", 
"pears"]])

should return

[["2", "green", "apples"],
  ["3", "green", "apples"],
  ["2", "red", "apples"],
  ["3", "red", "apples"],
  ["2", "green", "pears"],
  ["3", "green", "pears"],
  ["2", "red", "pears"],
  ["3", "red", "pears"]]

?

Lazyness would of course be a plus.


More information about the Digitalmars-d-learn mailing list