Combine lists by adding same values

Hello, how is it possible to add same value to list based on its structure. I added grasshopper file with data points i get, and i need to combine them according to the picture.

lists.gh (6.3 KB)

Is this what you want?

lists.gh (12.3 KB)


merge_lists_2025Jun20a.gh (12.3 KB)

I got the same thing but it’s better to never pass data through text panels.

Makes sense.

result needs to look like this, when second level of first list gets value based on second lists last level

There might be a simpler way, but this is my brute force approach.

lists.gh (22.4 KB)

I’m guessing that you got these lists because you didn’t pay attention to upstream data trees. If you’re going to create ridiculous situations like this, you have to learn to deal with them. Better yet is to learn how to avoid them!


merge_lists_2025Jun20b.gh (16.1 KB)

The two lists at the start have 10 and 8 items for a total of 18, yet your list at the end has 24 :interrobang:

Same thing. :roll_eyes: Wait, you have five branches with four items each for a total of 20.

Go up stream and fix where the lists got corrupted.

Yes, the OP’s example duplicates the data from one list, creating a copy of the appropriate branch from the second list appended to each branch of the original list. That example and mine differ because in mine I appended data even to empty lists in the original.