compose


compose(@restfn1, ...)
      

Return a function that is the composition of the functions fn1, .....

The returned function will take a variable number of arguments, apply the rightmost of fn1, ...s to the arguments, the next function in fn1, ... (right-to-left) to the result, and so on. Each of fn1, ..., except the last, must take exactly one argument. The last function can take an arbitrary number of arguments.

If compose is called with no arguments the identity function is returned.

Examples:


let negative_quotient = compose(sub, div)
negative_quotient(8, 3)
// -8/3

let s = compose(number_to_string, add)(10, 20, 8, 100)
s
// 138
is_string(s)
// true
      

Also see:

partial
complement
mapfn


Core Module Index | Contents