FunFunc v0.2.0 FunFunc.Func
Functions for generic purpose.
Link to this section Summary
Functions
Applys args to the curried function
Composition function
Constant function. It returns the first argument
Curry function
Flip function
Identity function. It always returns the argument
Ignore function. It returns the second argument
Return function. It returns the argument on the call
Link to this section Functions
Applys args to the curried function.
Examples
iex> f = fn a -> fn b -> fn c -> a + b + c end end end
iex> FunFunc.Func.apply_args(f, [1, 2, 3])
6
Composition function.
Examples
iex> FunFunc.Func.compose(&String.to_integer/1, &Integer.to_string/1).(1)
1
Curry function.
Examples
iex> FunFunc.Func.curry(&(&1 + &2)).(1).(2)
3
iex> FunFunc.Func.curry(&(&1 + &2 + &3)).(1).(2).(3)
6