jo spanner 13 Posted May 6, 2020 Hey, I have a quick question: Is there a way to check of all elements of an array are inside another array? I can imagine a way of writing code for this, but I wonder if there is some built-in function that might be quicker? Something to the effect of: array1 = [1,2,3]; array2 = [5,1,6,2,7,3]; array1 in array2; //evaluates to true? Share this post Link to post Share on other sites
wogz187 1085 Posted May 6, 2020 @jo spanner, Check this out, Have fun! 1 Share this post Link to post Share on other sites
Harzach 2414 Posted May 6, 2020 Just messing around here. There are likely cases where this will not work, but it seems to work for simple arrays like this. I'm sure there is a much more elegant solution. Code: _a1 = [1,2,3]; _a2 = [1,2,3,4,5]; _compare = _a1 arrayIntersect _a2; _bool = _compare isEqualTo _a1; hint str _bool; Result: 0.0092 ms Cycles: 10000/10000 2 Share this post Link to post Share on other sites