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


Implicit scanning in Icon

Much of the power of Icon in text analysis comes from the use of implicit scanning. In this technique, a particular string is designated as the current subject of scanning operations. Many of the usual string functions like ``match()'' can easily be used to analyze this subject.

In general, the expression

    e1 ? e2
means to make the string e1 the subject of scanning operations within expression e2. Within expression e2, you can call the common string functions like ``any()'' and ``find()'' and omit their second arguments. These functions will implicitly use the current subject as their second argument.

For example, this expression

    "syzygy" ? ( every write ( find ( "y" ) ) );
will produce the same result as
    every write ( find "y", "syzygy" );

Next: Setting the scanning subject in Icon
See also: Using the Icon programming language
Previous: Scanning for a substring in Icon

John W. Shipman, john@nmt.edu