Mandrake v0.0.2 Mandrake.Function

Mandrake functional functions.

Summary

Functions

Function that return always the given value

Returns the composition of two functions

Returns an anonymous function that wrap the given

Function that do nothing

Call the given function with the given object

Functions

always(value)

Function that return always the given value.

Examples

iex>  printExample = Mandrake.Function.always("Example")
...>  printExample.()
"Example"
build_args(string, remaining)
compose(first_function, second_function)

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"
lambda(function, arity)

Returns an anonymous function that wrap the given.

Examples

iex>  mod = Mandrake.Function.lambda("Mandrake.Math.modulo", 2)
...>  mod.(20, 5)
0
noop()

Function that do nothing

Examples

iex>  Mandrake.Function.noop()
nil
tap(function, value)

Call the given function with the given object.

Examples

iex>  Mandrake.Function.tap(fn arg -> Mandrake.Math.inc(arg) end, 5)
6