News flash: I'm going to Australia in February, so this Web site may be switched off at any time.


Implicit matching in Icon

Once a string e1 has been established as the implicit scanning subject (&subject) within expression e2 by use of the construct ``e1 ? e2'', several string functions implicitly refer to the ``current subject,'' meaning the characters of ``&subject'' starting at position ``&pos.''

For example, this expression

    "syzygy" ? every write ( find ( "y" ) );
writes three lines with the values 2, 4, and 6, because the string "syzygy" is established as the ``&subject'' within the expression after the ``?'' and because the ``find()'' function uses the subject as its implicit second argument.
Next: Using the tab function for parsing in Icon
See also: Using the Icon programming language
Previous: Setting the scanning subject in Icon

John W. Shipman, john@nmt.edu