Curry.curry
— Methodcurry(f)
Convert a function that accepts multiple arguments into an equivalent chain of single argument functions. Functions are chained as single argument anonymous functions that return single argument functions.
If multiple arities of a function exist, the one with the least number of arguments greater than 1 will be curried.
Examples
julia> curry(map)(sqrt)(1:4)
4-element Array{Float64,1}:
1.0
1.4142135623730951
1.7320508075688772
2.0
# arities 1 and greater than 2 exist for -, but arity 2 will be choosen for currying
julia> curry((-))(9)
#119 (generic function with 1 method)
julia> curry((-))(9)(1)
8
Curry.partial
— Functionpartial(f, x...)
Takes a function f and fewer than the normal arguments to f, and returns a function that takes a variable number of additional args. When called, the returned function calls f with args + additional args.
Curry.swap
— Methodswap(f)
Return a function with a reordered argument list. Reordered so first argument becomes the last.