ASPN : Python Cookbook : curry -- associating parameters with a function
ASPN : Python Cookbook : curry -- associating parameters with a function: "Title: curry -- associating parameters with a function
Submitter: Scott David Daniels
Last Updated: 2001/04/18
Version no: 1.2
Description:
In functional programming, currying is a way to bind arguments with
a function and wait for the rest of the arguments to show up later.
You 'curry in' the first few parameters to a function, giving
you a function that takes subsequent parameters as input and
calls the original with all of those parameters. This recipe uses
a class instance to hold the parameters before their first use.
For example:
Source: Text Source"
Submitter: Scott David Daniels
Last Updated: 2001/04/18
Version no: 1.2
Description:
In functional programming, currying is a way to bind arguments with
a function and wait for the rest of the arguments to show up later.
You 'curry in' the first few parameters to a function, giving
you a function that takes subsequent parameters as input and
calls the original with all of those parameters. This recipe uses
a class instance to hold the parameters before their first use.
For example:
double = curry(operator.mul, 2)
triple = curry(operator.mul, 3)
Source: Text Source"
<< Home