NAME

member - test if elements are members of a set

SYNOPSIS

res = lhs.member(rhs)

DESCRIPTION

Checks if each element of lhs is present in rhs. This is similar to APL val arr.

If lhs is a scalar, the result is a boolean indicating whether the scalar is in rhs.

If lhs is an array, the result is a boolean array of the same shape as lhs, where each element is true if the corresponding element of lhs exists in rhs, and false otherwise.

The implementation uses an internal dictionary for efficient lookup if rhs is large.

RETURN VALUE

Returns a boolean or a boolean array.

ERRORS

ArgCheck: Thrown if the number of arguments is not 2.

EXAMPLE

    3->member([1, 2, 3, 4])
true

    [1, 5, 2].member([1, 2, 3])
true false true

    "a".member("banana") // (checks characters in the string)
true

SEE ALSO

unique
union
intersect
without