When the expressions to be combined are small, write them on the same line:
F <x< G
When multiple pruning combinators are used to bind multiple variables (especially when the scoped expression is long), start each line with a combinator, aligned and indented, and continue with the expression.
long expression <x< G <y< H
The pruning combinator is not often written in its explicit form
in Orc programs. Instead, the val
declaration is often more
convenient, since it is semantically equivalent and mentions the variable
x
before its use in scope, rather than after.
val x = G val y = H long expression
Additionally, when the variable is used in only one place, and the expression is small, it is often easier to use a nested expression. For example,
val x = G val y = H M(x,y)
is equivalent to
M(G,H)
Sometimes, we use the pruning combinator simply for its capability to terminate
expressions and get a single publication; binding a variable is irrelevant. This
is a special case of nested expressions. We use the identity site Let
to put the expression in the context of a function call.
For example,
x <x< F | G | H
is equivalent to
Let(F | G | H)
The translation uses a pruning combinator, but we don't need to write the combinator, name an irrelevant variable, or worry about precedence (since the expression is enclosed in parentheses as part of the call).