How to curry and uncurry a function R→RN.
The functions A→BC corresponds to functions of the form A×C→B. Going from the function A×C→B to the function A→BC is called currying, while going from the function A→BC to the function A×C→B is called uncurrying.
Suppose f is a function A×C→B of two arguments, then we say its curried form f′ (not derivative) is a function A→BC of one argument but whose values are themselves functions. For a∈A, f′(a) is a function B→C whose value at b∈B is f′(a)(b)=f(a,b).
So a function R→RN corresponds to a function R×N→R. Take any function from R×N to R, say f(x,n)=x+n, then it is curried from f′ whose values at x denoted by f′(x) is the function N→R whose value at n is x+n. Symbolically, f′(x)(n)=f(x,n)=x+n.
0 Comments
Comments