This function works by generating a string and then using the Function constructor to define a function from that
string.
This makes the generated function extremely efficient, both in time and memory.
The generated code is also very easy to read, since it is effectively how a programmer would implement this by hand
if they had a fixed number of arrays.
Computes the cartesian product of a given collection of arrays. based on (but slightly faster than) https://github.com/ehmicky/fast-cartesian without any caching
This function works by generating a string and then using the
Functionconstructor to define a function from that string. This makes the generated function extremely efficient, both in time and memory. The generated code is also very easy to read, since it is effectively how a programmer would implement this by hand if they had a fixed number of arrays.The generated code looks like
Param: arrays
arrays to take the product of, in order