[“Function”, list-of-variables_, body]
[“Function”, variable, body]

Create a Lambda-function, also called anonymous function.

The first argument is a symbol or a list of symbols which are the bound variables (parameters) of the Lambda-function.

The others arguments are expressions which are evaluated sequentially, or until a ["Return"] expression is encountered.

The ["Function"] expression creates a new scope.

To apply some arguments to a function expression, use ["Apply"].


[“Apply”, body, expr-1, …expr-n]

Apply a list of arguments to a lambda expression or function.

The following wildcards in body are replaced as indicated

  • \_ or \_1 : the first argument
  • \_2 : the second argument
  • \_3 : the third argument, etc…
  • \_: the sequence of arguments, so ["Length", "_"] is the number of arguments

If body is a ["Function"] expression, the named arguments of ["Function"] are replaced by the wildcards.

["Apply", ["Multiply", "\_", "\_"], 3]
// ➔ 9
["Apply", ["Function", "x", ["Multiply", "x", "x"]], 3]
// ➔ 9

You can assign a Lambda expression to a symbol for later use:

cube = Lambda(_ * _ * _)
// ➔ 125

[“Return”, expression]

If in an ["Function"] expression, interupts the evaluation of the function. The value of the ["Function"] expression is expression