Split list

Hei, i would like to split this list by number into Brancher or sublist based on domain. For example, iteration starts by comparing the first number with others (in order) and checks if the mass substraction is < 5 then keeps them in same branch. Otherwise it splits them into first branch and then continue for the next new number and so on.

I would like the solution to be without manual script. Just using GH basic components.

Input

Output splitting list if difference < 5, keeping the order same


unnamed.gh (3.4 KB)

Hi @anon76319893


sorting lists.gh (7.2 KB)

1 Like

Hello,

This is the same problem as in this other thread

The domain approach above won’t give you exactly what you need. If you add for instance 12.1 in the list, it gets added to the third group although the distance to 7.2 is less than 5.

image

Unfortunately I don’t think such looping through values can be done without scripting.

1 Like