Comparing two lists and obtaining elements with relative index

Good afternoon. I tried to solve this problem but it seems i might be missing something. As you can see from the picture i have two lists, basically what i would like to obtain is a list where only the elements from NOT-empty lists from the second one, the value of which represents the index of the corresponding elements of the first one, are present.

Do you have any idea on how to treat this problem?

Thank you in advance.

Actually, not entirely sure how to make that work for all the nested lists you’ve got in Dynamo… No doubt it’s possible and someone better at Dyno can maybe tell you…

I’d go for Python… You need both lists to be the same nesting, so flatten the first one by 1 or make a custom node and use the levels on that.


Filter.dyn (10.0 KB)

2 Likes

just curious… why not use “List.GetItemAtIndex” here? I’m a beginner and would like to understand different perspectives.

1 Like

That works because you’ve got numbers corresponding to their indexes.

If you had, “xx” instead of 0 it would not work.

If you had 4 instead of 0 it would not work.

1 Like

oh I get that now, I thought OP already had indices of those elements and just wanted those elements at indices. :sweat_smile:

Maybe you’re right… I didn’t quite understand if the numbers would always be the corresponding indices.

Always good to allow for different scenarios though.

1 Like

i’m trying to understand what op wants but i can’t seem to wrap my head around it, maybe i need a full script, or maybe time to go home now, its already 6:25pm UTC+08:00 :smile:

Lucky you, it’s not even lunch time here yet. :expressionless:

1 Like

Thanks. It did worked great! It seems I have a lot to learn in terms of mindset. Thanks also to @Alien for the contribution!

2 Likes