News flash: I'm going to Australia in February, so this Web site may be switched off at any time.
Recall that Icon's ``e1 ? e2
''
operator not only sets the subject ``&subject
''
to e1 during the evaluation of e2, but it
also sets up an implied position in a variable
called ``&pos
''.
The implied subject for string scanning is strictly defined as
the portion of the current subject past the current
position. So, if ``&pos
'' is 3, then
the current subject is all but the first two characters of
``&subject
''.
You can use the tab()
function to work your way
through a complex subject. Here is what a call to
``tab ( n )
'' does:
&pos
) is saved.
For example, ``tab ( many ( &digits ) )
''
finds the position of the next character in the subject that is
not a digit, sets the new position there, and returns the string
of digits between the old and new positions.
john@nmt.edu