Details of Icon Infix Operations (part 3)


x(x1, x2, ..., xn) : xm -- process argument list

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

x ! L -- process argument list

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} : xm -- process argument list as co-expressions

x{x1, x2, ..., xn} is equivalent to x([create x1, create x2, ... create xn]).
See also:       x(...), create expr

break expr : x -- break out of loop

break expr exits from the enclosing loop and produces the outcome of expr.
Default:
expr &null

See also:       next

case expr of {...} : x -- select according to value

case expr of {...} produces the outcome of the case clause that is selected by the value of expr.

create expr : C -- create co-expression

create expr produces a co-expression for expr.

every expr1 do expr2 -- generate every result

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 -- fail from procedure

fail returns from the current procedure, causing the call to fail.

if expr1 then expr2 else expr3 : x -- select according to outcome

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 -- go to beginning of loop

next transfers control to the beginning of the enclosing loop.

not expr : n -- invert failure

not expr produces the null value if expr fails, but fails if expr succeeds.

repeat expr -- evaluate repeatedly

repeat expr evaluates expr repeatedly.

return expr -- return from procedure

return expr returns from the current procedure, producing the outcome of expr.

suspend expr1 do expr2 -- suspend from procedure

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 -- loop until result

until expr1 do expr2 evaluates expr2 each time expr1 fails; it fails when expr1 succeeds. The do clause is optional.

while expr1 do expr2 -- loop while result

while expr1 do expr2 evaluates expr2 each time expr1 succeeds; it fails when expr1 fails. The do clause is optional.

expr1 | expr2 : x1, x2, ... -- evaluate alternatives

expr1 | expr2 generates the results for expr1 followed by the results for expr2.

|expr -- evaluate repeatedly

|expr generates the results for expr repeatedly, terminating if expr fails.

expr \ i : x1, x2, ..., xi -- limit generator

expr \ i generates at most i results from the outcome for expr.

x ? expr : x -- scan string

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.