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:

scala> import treehugger.forest._, definitions._, treehuggerDSL._
import treehugger.forest._
import definitions._
import treehuggerDSL._

scala> val tree = Predef_println APPLY LIT("Hello, world!")
tree: treehugger.forest.Apply = Apply(Ident(println),List(Literal(Constant(Hello, world!))))

scala> treeToString(tree)
res0: String = println("Hello, world!")

scala> val tree2 = (REF("x") DOT "y") APPLY (LIT(0), LIT(1))
tree2: treehugger.forest.Apply = Apply(Select(Ident(x),y),List(Literal(Constant(0)), Literal(Constant(1))))

scala> treeToString(tree2)
res1: String = x.y(0, 1)

Function application on selections 

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

scala> val tree3 = (REF("x") DOT "y")(LIT(0), LIT(1))
tree3: treehugger.forest.Apply = Apply(Select(Ident(x),y),List(Literal(Constant(0)), Literal(Constant(1))))

scala> treeToString(tree3)
res2: String = x.y(0, 1)

Sequence arguments 

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

scala> val tree4 = THIS APPLY (SEQARG(REF("list")))
tree4: treehugger.forest.Apply = Apply(This(),List(Typed(Ident(list),Ident(_*))))

scala> treeToString(tree4)
res3: String = this((list: _*))

Named arguments 

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

scala> val tree5 = REF("put") APPLY (REF("x") := LIT(0))
tree5: treehugger.forest.Apply = Apply(Ident(put),List(Assign(Ident(x),Literal(Constant(0)))))

scala> treeToString(tree5)
res4: String = put(x = 0)

Partially applied functions 

Partially applied functions are written by calling APPLY with PARTIALLY:

scala> val tree6 = REF("put") APPLY PARTIALLY
tree6: treehugger.forest.Apply = Apply(Ident(put),List(Ident(<partially>)))

scala> treeToString(tree6)
res5: String = put _

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