Function Applications

There are two ways to write function applications. The first way is calling APPLY(arg, ...) on a symbol or a tree. Here, arg denotes a Tree:

Predef_println APPLY LIT("Hello, world!")
(REF("x") DOT "y") APPLY (LIT(0), LIT(1))

These print as:

println("Hello, world!")
x.y(0, 1)

Function application on selections

The second way is to apply arg, ... on intermediate structure returned by DOT(sym|"y"):

(REF("x") DOT "y")(LIT(0), LIT(1))

This prints as:

x.y(0, 1)

Sequence arguments

To pass sequence into a vararg parameter, use SEQARG(arg):

THIS APPLY (SEQARG(REF("list")))

This prints as:

this((list: _*))

Named arguments

To pass named arguments into a function, specify the parameter using REF(sym|"x") as follows:

REF("put") APPLY (REF("x") := LIT(0))

This prints as:

put(x = 0)

Partially applied functions

Partially applied functions are written by calling APPLY with PARTIALLY:

REF("put") APPLY PARTIALLY

This prints as:

put _

Note this is different from APPLYing WILDCARD since PARTIALLY applies to the entire parameter list.