Reorganize List by Pattern

Hey All,

I’m trying to reorder this list of values so that instead of sorting from smallest to largest the list would be reordered to follow a large, medium, small pattern. So ideally, if I had a list (1,2,3,4,5,6,7,8,9), It would be reordered to EDIT (7,4,1,8,5,2,9,6,3). Unfortunately, my issue isn’t as simple because I have a large list of continuous, numbers with long decimals. My intuition here is to separate the list into 3 separate lists, small numbers, medium numbers, and large numbers, then have them recompiled into one list where it takes 1 number from the large list, then the medium list, then small list, and repeats that pattern. Unfortunately, I’m not really sure how to do this in Grasshopper so it’d be great if anyone here could help me! I’ve attached a screenshot of
my gh project, and I can attatch the actual gh file if it’s needed.

Thanks!

i

How you reordered this (1,2,3,4,5,6,7,8,9) to this (1,9,4,2,8,4,3,5,7)? What is your logic?

Sorry! I meant (7,4,1,8,5,2,9,6,3) basically if I were to seperate this list into 3 seperate lists (123,456,789) It would take 1 number from each list and organize them in descending order, and repeat the pattern. . Does that make sense?

If exactly like this it is simple
With Grasshopper
123456789
1-Use partition list to 3
2-Sort list and reverse

num.gh (7.5 KB)

flip_matrix

flip_matrix2

Hey!

I got this to work with the example I showed, but when I tried to apply it a longer list, It ended up not working! It ended up giving me 3 lists of 274 instead of lists of three.

Try changing the Partition ‘S’ input from ‘3’ to ‘274’?

flip_matrix3