longstr.icn: Procedure to match longest string

link longstr
June 1, 1991; Jerry Nowlin
Contributors: Stephen B. Wampler, Kenneth Walker, Bob Alexander, and Richard E. Goerwitz
This file is in the public domain.

longstr(l,s,i,j) works like any(), except that instead of taking a
cset as its first argument, it takes instead a list or set of
strings (l).  Returns i + *x, where x is the longest string in l
for which match(x,s,i,j) succeeds.  Fails if no match occurs.

Defaults:
    s     &subject
    i     &pos if s is defaulted, otherwise 1
    j     0

Errors:
    The only manual error-checking that is done is to test l to
    be sure it is, in fact, a list or set.  Errors such as non-
    string members in l, and non-integer i/j parameters, are
    caught by the normal Icon built-in string processing and sub-
    scripting mechanisms.

Source code | Program Library Page | Icon Home Page