Mandrake v0.0.4 Mandrake.Function
Mandrake functional functions.
Summary
Functions
Function that return always the given value
Apply the second argument to the function
Returns the composition of two functions
Returns an anonymous function that wrap the given
Function that do nothing
Functions
Function that return always the given value.
Examples
iex> printExample = Mandrake.Function.always("Example")
...> printExample.()
"Example"
Apply the second argument to the function.
Examples
iex> mod = Mandrake.Function.apply(fn arg -> -arg end, -2)
2
Returns the composition of two functions.
Examples
iex> printHello = Mandrake.Function.compose(fn x -> "Hello " <> to_string(x) end, fn y -> y + 1 end)
...> printHello.(6)
"Hello 7"
Returns an anonymous function that wrap the given.
Examples
iex> mod = Mandrake.Function.lambda("Mandrake.Math.modulo", 2)
...> mod.(20, 5)
0