intersect(): retain shared values
intersect(a, b) returns values that occur in both collections. It is useful for comparing tags, allowed options, IDs, or candidate lists.
Example
The intersection of [1, 2, 3] and [2, 3, 4] is [2, 3]. The precise treatment of duplicates and ordering follows the calculator’s collection rules, so do not assume it is a multiset operation without testing representative input.
Set-style workflows
Use setUnion() to combine unique values, setDifference() to find values excluded by another list, and setIsSubset() to test one membership. compare() helps establish an ordering before presentation.
Input caution
Compare compatible item types. Text case, floating-point approximations, and nested objects can make values that look alike fail equality checks.