Details of Icon Infix Operations (part 3)
If x is a function or procedure, x(x1, x2, ..., xn) produces the outcome of
calling x with arguments x1, x2, ..., xn.
If x is an integer, x(x1, x2, ..., xn) produces the outcome of xi, but fails if
i is out of the range 1, ..., n. In this case, it produces a variable if xi is
a variable; i may be nonpositive.
See also: x ! L
If x is a function or procedure, x ! L produces the outcome of
calling x with the arguments in the list L. If x is an integer, x!L produces
L[x] but fails if x is out of range of L.
See also: x(...)
x{x1, x2, ..., xn} is equivalent to x([create x1, create x2, ... create xn]).
See also: x(...), create expr
break expr exits from the enclosing loop and produces the outcome
of expr.
Default:
expr &null
See also: next
case expr of {...} produces the outcome of the case
clause that is selected by the value of expr.
create expr produces a co-expression for expr.
every expr1 do expr2 evaluates expr2 for each
result generated by expr1; it fails when expr1 does
not produce a result. The do
clause is optional.
fail returns from the current procedure, causing the call to fail.
if expr1 then expr2 else expr3 produces the
outcome of expr2 if expr1 succeeds, otherwise the outcome
of expr3. The else
clause is optional.
next transfers control to the beginning of the enclosing loop.
not expr produces the null value if expr fails,
but fails if expr succeeds.
repeat expr evaluates expr repeatedly.
return expr returns from the current procedure, producing the
outcome of expr.
suspend expr1 do expr2 suspends from the current procedure,
producing each result generated by expr1. If suspend is resumed,
expr2 is evaluated before resuming expr1.
The do
clause is optional.
until expr1 do expr2 evaluates expr2 each
time expr1 fails; it fails when expr1 succeeds.
The do
clause is optional.
while expr1 do expr2 evaluates expr2 each
time expr1 succeeds; it fails when expr1 fails.
The do
clause is optional.
expr1 | expr2 generates the results for expr1
followed by the results for expr2.
|expr generates the results for expr
repeatedly, terminating if expr fails.
expr \ i generates at most i results from the outcome for
expr.
x ? expr saves the current subject and position and then sets them to
the values of x and 1, respectively. It then evaluates expr. The
outcome is the outcome of expr. The saved values of the subject and
position are restored on exit from expr.