Hat tip to Oleg who posted this tip on the mailing list some time ago.
The basic ideas is that instead of looping over an array with a Repeat with Counter, you use Generate Sample Set to get a data set, and you do everything in a per-generated element context.
As an example, let’s revisit the problem of taking one array and creating a new array where each element is the sum of the elements before it.
The old way, with a Repeat with Counter node, looks like this:
Using Generate Sample Set, you can work with a data set and use that to access the array elements:
Generate Sample Set is set up to give an exact number of samples:
