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" );