ismember

ismember <value> <iterable>

Test whether a value equals some element of an iterable.

The comparison is the eq equality test, applied to each element in turn.

Arguments

Returns

A booltrue if some element is eq to <value>, false otherwise (including when the iterable is empty).

Examples

after command (say) {
  do "say member? [ismember two [words "one two three"]]"
}

"two" matches an element, so [ismember ...] evaluates to true and the mob says "member? true."

after command (say) {
  require [ismember $actor [creatures $self]]
  do "smile $actor"
}

The require guard lets the handler proceed only when the actor is among the living creatures in the owner's room. Because the match uses eq, comparing strings is case-sensitive — for prefix or case-insensitive word matching, use hasabbrev.

See also