Searching a list for occurrences of another list of items to create a dispatch pattern

I have a list of say 19 items - I would like to search this for occurrences of a smaller list of items (4). I would like a list along the lines of (0, 1, 0, 0, 1) the ones being where a value was found so that I can use this as a method of dispatching the list into two separate lists.

I then intend to operate on the data and combine it back together following the same pattern but that will be straight forward if I can do the first part.

Search pts for occurences.gh (10.2 KB)

“items”? Geometry or numbers? As always, posting a GH file is best.

Sorry I didn’t attach - amended now

From your description, I thought you were looking to match a sequence but looking at the points, it sounds like that’s not the case?

The Sort Along Curve and Move components with data embedded and hidden wires threw me for awhile… This is your data (A and B) and their Set Intersection:

It feels like a MIndex (Member Index) problem?

I hit my head against MIndex index for a while before posting, but found a solution using repeated Replace Members and Set Difference. I think there will be a smoother way to do it as it is a simple concept but it will do for now.

Icons with ‘Draw Full Names’, my least favorite presentation, and no GH file again - so we’ll never know how you solved it unless you share the code.

Before starting this thread or since my post? Because that was only a few minutes ago. MIndex isn’t easy to grasp.

FSim (Find similar member) gives you the index values in ‘A’ for points that are in ‘B’:


Search pts_2020May22b.gh (16.5 KB)

Before coming to the forum this morning I was trying to achieve the same outcome with MIndex but didn’t get anywhere - I could see Replace could take in the list and the output from Indices (i) but wasn’t sure how to provide the replacement Items (i) in the right order / length

Search pts for occurences.gh (10.3 KB)

Your file is useless to me. Oh well.

missing

That’s unfortunate - those components are the operations post-dispatch, pre-weave. Solution for posterity: Search pt list for matching pts create dispatch pattern.gh (6.0 KB)

No thanks, I’ve squandered too much time on this one already.