The table below summarizes the different expression forms in Wrapl. The following notation is used in the table; idi denotes an idenitifer, expri denotes an expression and decli denotes a declaration.
Evaluates to the constant Std.Object.Nil, used to denote the absence of any other value.
Fails to produce any value, causing the current expression to backtrack.
Returns the value of expr. If expr is a reference, then . expr returns the current value of expr without any reference.
Returns the type of expr.
Returns expr2 if expr1 and expr2 are the same object, fails otherwise.
Returns expr2 if expr1 and expr2 are not the same object, fails otherwise.
Returns a list (instance of Std.List.T) with elements expr1, expr2, ..., exprk
Returns a table (instance of Std.Table.T) with pairs (exprki, exprvi). Any value exprvj is omitted, the value NIL is used.
Returns a list of all the values produced by expr.
Returns a table with the (unique) values produced by expr as keys.
where signature is of the form [@|= expr1], ..., [@|= exprk].
Adds expr (which should be an invokable object) to :method corresponding to signature, where @ type denotes a type match and = value denotes a value match, using Std.Symbol.Set. Returns expr.
The old keyword can still be used instead of .
Assigns the value of expr2 to the reference produced by expr1. If expr1 does not evalute to a reference then Wrapl.Loader.IncorrectAssignMessageT message is sent. Within the evaluation of expr2 the special variable $ can be used to refer to the current value of expr1.
Assigns the value of expr1 to the reference produced by expr2. If expr1 does not evalute to a reference then Wrapl.Loader.IncorrectAssignMessageT message is sent.
Creates a new function object with parameters id1, ..., idk and body expr. If a parameter is followed by + it is passed by reference, other it is passed by value. A * after the final parameter indicates that it is a variadic parameter, any extra arguments are collected into a Wrapl.Loader.VariadicT and passed in this parameter.
Creates a new Std.Function.VariableT object that returns the variable produced by expr. This is equivalent to a call to Std.Function.VariableNew with expr.
Creates a new Std.Function.ConstantT function object that returns the value produced by expr. This is equivalent to a call to Std.Function.ConstantNew with expr.
where signature is of the form [id1[+]] [@|= expr1], ..., [idk[+|*]] [@|= exprk].
Equivalent to METH :method(signature') IS func (see here) where signature' is the type/value information in signature (i.e. ignoring any identifiers and pass-by-reference markers) and func is the function: <id1[+], ..., idk[+]> [ VAR | DEF ] expr (creating unique id's for those omitted). Returns func.
The old keyword can still be used instead of .
Calls the function expr0 with arguments expr1, ..., exprk. If the function fails, exprk is resumed and the function is called again. If exprk fails, exprk-1 is resumed, and so on.
Calls the function expr0 with arguments expr1, ..., exprk. If the function fails, each expr1, expr2, ..., exprk is resumed and the function is called again.
Returns expr from the current function.
Exits the current function without producing any value (failing).
Suspends the current function producing the value expr. If the function in resumed, evaluation continues with SUSP expr producing the value of expr.
If expr0 succeeds, returns the values produced by expr1 otherwise returns the values produced by expr2. If the failure clause (// expr2) is omitted and expr0 fails, the entire expression fails. If the success clause (=> expr1) is omitted and expr0 succeeds, the entire expression fails.
Creates a new scope for the evaluation of each declaration decl and each expression expr. The block expression produces the value(s) of the last expression in the block. A block expression can contain a RECV expression for handling message.
For each i = 1, ..., k: binds idi to the value of expri and produces the values produced by expr. If expri produces an assignable reference, then idi will be assignable.
Normally, an expression of the form id1.id2 denotes the variable/constant id2 imported from the module id1. However, if id1 is not a constant then a runtime call to :"." is made. Thus expr1.expr2 is equivalent to :"."(expr1, expr2) except when expr2 is an identifier, in which case expr1.id2 is equivalent to :"."(expr1, "id2").
Repeatedly evaluates expr.
For each value produced by expr0 evaluates expr1.
Causes the current loop to start its next iteration.
Exits the current loop with the value(s) of expr. Note that expr is evaluated in the context directly outside the loop, in particular this affects STEP, EXIT and SEND expressions.
WHILE expr is equivalent to expr // EXIT NIL.
UNTIL expr is equivalent to expr => EXIT NIL.
For each value produced by expr1, produces all the values of expr2. If expr1 fails then the entire expression fails, thus expr1 & expr2 behaves like a shortcut logical and expression which returns it's second operand if it succeeds.
For each value V produced by expr1, produces V for each value produced by expr2. Within the evaluation of expr2 the special variable $ can be used to refer to the value produced by expr1, thus expr1 \ expr2 can be used to mean "such that".
Produces all the values produced by expr1 followed by the values produced by expr2. Since expr1 | expr2 will produce a value if either expr1 or expr2 succeeds, it behaves like a shortcut logical or expression.
Causes expr1 and expr2 to produce values in parallel: for each value produced by expr1 the next value produced by expr2 is returned. The expression fails when either expr1 or expr2 fails.
Generates the values produced by expr1, expr2, ..., exprk in an interleaved fashion; i.e. the first value produced by expr1 is produced, followed the first from expr2 and so on until the first value from exprk is produced. Then the second value from expr1 is produced, then the second from expr2 and so on. The expression fails when any of expr1, expr2, ..., exprk fail.
Produces the first expr1 values produced by expr2.
Produces all but the first expr1 values produced by expr2.
Generate all the values of expr repeatedly. If expr fails to produce any values, then the entire expression fails.
Returns the sum of the values produced by expr. Fails if expr fails to produce any values.
Returns the product of the values produced by expr. Fails if expr fails to produce any values.
Returns the number of values produced by expr. Returns 0 if expr fails to produce any values.
Returns an instance of Std.Function.IteratorT which produces the values produced by expr.
Returns the next value produced by expr which should be an instance of Std.Function.IteratorT.
Catches messages sent in the current block. The message sent is assigned to id and value(s) produced by expr is returned as the value of the block. Note that RECV expressions receive all messages, it is therefore necessary to resend unhandled messages using SEND.
Sends expr as a message. The first enclosing (at runtime) RECV expr will receive the message.
Produces the value of expr as evaluated at compile time. If expr fails or sends msg at compile time, then `expr` is equivalent to BACK or SEND msg respectively. Since expr is evaluted at compile time, it may only use constants and global variables.