Check multiple items for presents across multiple lists

Hello dear experts,
Can you please advise how in Grasshopper I can check if an item exist in multiple lists.
Lets say I have items list1 = [ A, B, C, D] and I have a list of lists list2 = [ [1,B,10,D], [10,K,A] ,[C,D,22,99,43] ]
I need to check each item from the list1 if it can be found in any sub list from the list2.
in the return I am okay with a list of True / False results for each item from the list1.
Example for the Item A:
A: [False, True, False] → Item A can be found only in the 2nd sub list of the list2.
Same results I need for all other items in the list1. So I will have a nested list with True/False values
A: [False, True, False]
B: [True, False, False]
C: [False, False, True]
D: [True, False, True]

I know how it can be done in Dynamo but Grasshopper works in a different way

It would be so much easier to answer this question if you posted a GH file that contains your sample data instead of requiring each person to re-create those lists.

3. Attach minimal versions of all the relevant files

What a pain :exclamation: It would be so much easier if you posted this GH file:

lists_2023Sep17a

1 Like

Hi Joseph,
Thank you for your reply,
The actual file and the subject is much more complex. The data described in the post just to explain the nature of an issue. I do not need anyone to do the project for me here. I need just to see which how with grasshopper components I can force grasshopper check if A, B, C, D exist in other lists. You have recreated what the described sample only. It can be anything else. We can search for Bananas and Oranges instead of A,B,C,D

It’s hard to program without knowing the type of objects to compare/test.

Here an example comparing strings:


multiple equality tests.gh (9.1 KB)

The “test” is a simple:

  private void RunScript(string x, string y, ref object R)
  {
    R = x == y;
  }

(there is not a native component for comparing strings…)


Can you show a understandable picture of how was the solution with Dynamo?
I’ve never used it or Revit, but i’m curious…

lists_2023Sep17b