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.

Reply via email to