How to create a Boolean Mask against two uneven lists?

This question is an extension to a question posed by @eddymejia08 List.ContainsItem doesn’t check full list
What I’d like to achieve is a True/False match against the longest list by a shorter list. See image below, one list contains the numbers 1 to 45 the other contains the odd numbers 1 to 29. I can change the lacing to cross product which will identify a match in the correct sequence, but how do I create a Boolean mask against the longer list (i.e. 45 true or false) to use in a “List.FilterByBoolMask” to create a true false match against the longer list ?

@r.lietz are you after that?

@r.lietz Something like this?

1 Like

Brillant, thanks to both Vikram and Salvatore, the solutions have come quicker than a speeding ticket.

But perhaps my illustration was a little too regular for Salvatore’s solution, as when I tried it against real numbers that I have, it doesn’t quite work. And for Vikram’s, I appreciate your work, but this can be simplified further with the use of the following nodes.

BOOLEAN%20MASK_03

What I’m looking for is a true or false match against the 45 listed numbers coming from the list of 15 numbers.

2 Likes

To explain further, it seems the Point.x value is handled differently than Numbers, and as a consequence the List.Contains does not work when applied to Point.x values. The List.Transpose works but not the List.AnyTrue in this case.

It’s a rounding issue. Limit the number of decimal spaces

Not if your intent is to obtain a bool mask :expressionless:
Ignore the last three nodes. My example there was only extended to demonstrate the working of the mask.

Well, if you end up with a speeding ticket, you generally have to cough up at some stage.

And after reviewing the evidence, I was only a little over the limit your Honour, it seems I forgot to properly lace up my boots. So the important lesson is that, when dealing with uneven lists, you need to pay attention and set your lacing to “Cross Product” on, in this case, on both “Lists.Contains”.

Apologies to Vikram, he is right if you want a boolean mask, his solution is correct and rather neat, but I’d be careful about applying any rounding of decimal points.

And Nick Boyts does a very good job, explaining it in the original post, sometimes you can’t see the wood for the trees.

2 Likes