44 lines
968 B
Plaintext
44 lines
968 B
Plaintext
|
|
{{alias}}( ...f )
|
|
Function composition.
|
|
|
|
Returns a composite function. Starting from the right, the composite
|
|
function evaluates each function and passes the result as an argument
|
|
to the next function. The result of the leftmost function is the result
|
|
of the whole.
|
|
|
|
Notes:
|
|
|
|
- Only the rightmost function is explicitly permitted to accept multiple
|
|
arguments. All other functions are evaluated as unary functions.
|
|
- The function will throw if provided fewer than two input arguments.
|
|
|
|
Parameters
|
|
----------
|
|
f: ...Function
|
|
Functions to compose.
|
|
|
|
Returns
|
|
-------
|
|
out: Function
|
|
Composite function.
|
|
|
|
Examples
|
|
--------
|
|
> function a( x ) {
|
|
... return 2 * x;
|
|
... }
|
|
> function b( x ) {
|
|
... return x + 3;
|
|
... }
|
|
> function c( x ) {
|
|
... return x / 5;
|
|
... }
|
|
> var f = {{alias}}( c, b, a );
|
|
> var z = f( 6 )
|
|
3
|
|
|
|
See Also
|
|
--------
|
|
|