News flash: I'm going to Australia in February, so this Web site may be switched off at any time.
An Icon expression can produce any number of results---zero, one, two, a million. The results are produced in sequence, one at a time.
The evaluation of expressions in Icon depends on the context from which the expression is evoked:
v := e
''),
an expression is evaluated only until it either fails
(produces no values) or succeeds (produces at least
one value).
every e1 do e2
'' clause, though,
it may produce any number of values.
The fact that expressions can fail actually makes it easier to handle exceptional cases. Suppose you are writing a procedure that computes the root of an equation, but some equations have no root. Rather than having to figure out what value you should return in that case, the procedure can simply fail.
You can test to see if a procedure failed. For example:
if not Some_Proc ( ) then...where ``
Some_Proc
'' is some procedure that may fail.
john@nmt.edu