Parameter combination calculation and iteration

At the moment I’ve been playing with pulsar synthesis — very few parameters and a huge amount of variation. A perfect candidate for some neural networks ;). At this point I want to be able to generate all of the combinations of parameters within a range and with a certain resolution. To do this, I looked at some code @jacob.hart wrote for calculating the cartesian product of an array in javascript. I wanted to distill his specific use case into a generalised script, thus giving rise to this bit of code I’m sharing today:

There’s no reason I couldn’t have used the js object instead of node.script (initially I pulled in some libraries to do the math for me), however, I find ES6 more expressive than whatever dusty old version (ES5??) is running in the js object.

The interface is very simple, add some parameters and ranges, set the resolution and hit calculate. Then you can iterate through all of the combinations and route them. In theory should also work with any combination of primitive types, so perhaps its useful if you wanna combine a bunch of strings/arrays/dictionaries etc.

The repo contains a patch demonstrating how it can be used.

Hope someone else finds it useful or interesting!