Module combinator

Source
Expand description

Combinators

A combinator is a higher-order function that uses only function application and earlier defined combinators to define a result from its arguments.

Functionsยง

apply
The apply function apply(f, x) = f(x) also known as A (Apply) combinator. It is the same as function application.
apply_to
The application function apply_to(x, f) = f(x) also known as T (Thrush) combinator.
converge
Provides a means of passing an accumulating function and two branching functions. A value can be applied to the resulting function which will then be applied to each branching function, the results of which will be applied to the accumulating function.
fix
This function also known as Y combinator allows for recursive functions to be defined in a more natural way. It takes a function that takes a function and a value, and returns a value. The function is then applied to itself, and the value is returned.
id
The identity function id(x) = x also known as I (Idiot) combinator.
if_else
This function allows for conditionals in composition chains. Unlike converge, which branches and merges, if_else chooses which function to run based on the predicate, and the other function is ignored.
noop
The no operation function.
noop1
The no operation function of 1 argument.
noop2
The no operation function of 2 arguments.
noop3
The no operation function of 3 arguments.
noop4
The no operation function of 4 arguments.
noop5
The no operation function of 5 arguments.
noop6
The no operation function of 6 arguments.
noop7
The no operation function of 7 arguments.
noop8
The no operation function of 8 arguments.
noop9
The no operation function of 9 arguments.
noop10
The no operation function of 10 arguments.
noop11
The no operation function of 11 arguments.
noop12
The no operation function of 12 arguments.
on
This function, also called the Psi combinator, allows you to call a function on transformations of values. It can be considered the sister of converge. Where converge takes one argument and maps it through two unary functions, merging the resulting values with a binary function, psi takes two arguments and runs them each through the same unary function before merging them with the given binary function.
substitution
This substitution function, also known as S (Starling) combinator, is used when you have a binary function and you can supply the first argument and can use that value to create the second argument.
tuple2
Create a tuple of 2 elements.
tuple3
Create a tuple of 3 elements.
tuple4
Create a tuple of 4 elements.
tuple5
Create a tuple of 5 elements.
tuple6
Create a tuple of 6 elements.
tuple7
Create a tuple of 7 elements.
tuple8
Create a tuple of 8 elements.
tuple9
Create a tuple of 9 elements.
tuple10
Create a tuple of 10 elements.
tuple11
Create a tuple of 11 elements.
tuple12
Create a tuple of 12 elements.