abbrev
abbrev <iterable> <word>…
Whether any word produced by an iterable is a prefix abbreviation (ignoring case) of any of the given words.
abbrev takes an iterable of strings followed by one or
more candidate words. It is true when some word in the iterable is a
case-insensitive prefix of some candidate — that is, when the iterable word
abbreviates the candidate. This is the prefix-matching sibling of
keyword, which requires exact equality.
Note the direction: the iterable word must abbreviate the candidate
argument, not the other way around. So an iterable yielding no matches
the candidate north, but an iterable yielding north does not match the
candidate no. An empty iterable word never matches.
Because a bare string is not iterable, convert one with
words first.
Arguments
<iterable>— an iterable yielding strings (for example fromwordsoralias).<word>…— one or more candidate strings; the call takes two or more arguments in total.
Returns
A bool — true if any iterable word is a case-insensitive prefix of any candidate, false otherwise.
Examples
after command (say) {
do "say abbrev=[abbrev [words 'no ea'] north]."
}
The iterable yields no and ea; no is a prefix of the candidate
north, so [abbrev ...] is true.
after command (say) {
do "say abbrev=[abbrev [words 'north east'] no]."
}
Here neither north nor east is a prefix of the candidate no, so the
result is false — the iterable word, not the argument, must be the
abbreviation.
See also
keyword— the same shape, but matching by exact equality.isabbrev,hasabbrev— abbreviation against a single string / iterable.words— turn a string into an iterable of words.- Iterables and iterables