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
<value>— the value to look for.<iterable>— a list or any iterable. A bare string is not iterable; convert it first withwords.
Returns
A bool — true 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
hasabbrev— membership by prefix abbreviation instead of exact equality.some— membership under an arbitrary predicate.- Operators · Iterables and iterables