# View Source Quark.Curry(Quark v2.3.3-doma)

Currying breaks up a function into a series of unary functions that apply their arguments to some inner n-ary function. This is a convenient way to achieve a general and flexible partial application on any curried function.

# Link to this section Summary

## Functions

Curry a function at runtime, rather than upon definition

Define a curried function

Define a curried private function

Convert a curried function to a function on pairs

Apply one or more arguments to a curried function

# curry(fun)

View Source
`@spec curry((... -> any())) :: (... -> any())`

Curry a function at runtime, rather than upon definition

## examples Examples

``````iex> curried_reduce_3 = curry &Enum.reduce/3
...> {_, arity} = :erlang.fun_info(curried_reduce_3, :arity)
...> arity
1

iex> curried_reduce_3 = curry &Enum.reduce/3
...> curried_reduce_3.([1,2,3]).(42).(&(&1 + &2))
48``````

View Source (macro)

Define a curried function

View Source (macro)

Define a curried private function

# uncurry(fun)

View Source
`@spec uncurry((any() -> (... -> any()))) :: (any(), any() -> any())`

Convert a curried function to a function on pairs

## examples Examples

``````iex> curried_add = fn x -> (fn y -> x + y end) end
3``````

# uncurry(fun, arg_list)

View Source
`@spec uncurry((... -> any()), any() | [any()]) :: any()`

Apply one or more arguments to a curried function

## examples Examples

``````iex> curried_add = fn x -> (fn y -> x + y end) end