Partial Application:
Filter:
Reference | Language

Partial Application

Create Functions via Partial Application

Partial application is a way to create a function by passing only some arguments to a method. The _ character stands in for missing arguments and becomes an argument to the created function. It only applies to a single method, list, or dictionary call, not to a more complex nested expression.

for example:

f is now a function of one argument.

it is equivalent to having written:

(except that there is no name 'x' declared)

g is a function of two arguments.

Here are some example usages of this in a collect message. Below each is written the equivalent function.

An example of what you can't do: