Pike v8.1 release 6

Method Function.curry()


Method curry

function(mixed ... :function(mixed ... :mixed|void)) curry(function(:void) f)

Description

Partially evaluate a function call.

This function allows N parameters to be given to a function taking M parameters (N<=M), yielding a new function taking M-N parameters.

What is actually returned from this function is a function taking N parameters, and returning a function taking M-N parameters.

Example

This example creates a function adding 7 to its argument.

Function.curry(`+)(7)