Sequential (Recursive?) List Reordering

List B is a list of curve parameters. List A shows the different parameters from list B broken out into their own branches with values correlated to the original indices for each item. I would like to use List A to create a new list with the proper pattern.

Is there any way to combine the items from Branch {1} into Branch {0} where the items from {1} are inserted into the Even Indices of {0} giving the result: 1,0,2
This process would repeat itself where items from Branch {2} are inserted into the previous resulting list at the Even Indices giving the result: 3,1,4,0,5,2,6
This would repeat until all of the items for all of the Branches have been recombined into a new list.

I believe that some sort of looping structure might be needed but I have no idea where to start. Maybe something like this is easy to achieve using a script?

If you don’t mind using anemone since this is recursive:

recursive.gh (8.9 KB)

Thank you for the quick reply, I wasn’t expecting that! Works like a dream, thank you!


sort.gh (15.8 KB)
03:30 am here, just some thought->.gh before turning off… maybe it’s wrong.

This “sorting” seems related to the “square wave” made by the sum of many harmonics.
(Edit: no, it’s more likely to be unrelated…)

Using the “Block” setup of the “Interpolate” component does the trick.

In the picture some points, ordered like red arrows.
Green is after sorting.

3 Likes