Noether (noether v0.2.5)
Noether aims to ease common data manipulation tasks by introducing simple algebraic functions and other utilities. Functions and names are inspired (sometimes taken as-is) from Haskell.
The Noether.Maybe
module introduces operations on nullable values.
The Noether.Either
module introduces operations on {:ok, _} | {:error, _}
values.
The Noether.List
module introduces operations on lists.
The root module has a few simple functions one might find of use.
Link to this section Summary
Functions
Takes a tuple and a function of arity 2. It applies the two values in the tuple to the function.
Takes a function of arity 2 and returns the same function with its arguments in reverse order, i.e., "flipped". Please note that if a function of different arity is given, a function of arity 2 is returned where the two arguments will be applied to the given function.
Takes two values and applies them to a function or arity 1 in form of a tuple.
Link to this section Types
fun1()
fun2()
Link to this section Functions
curry(arg, f)
Takes a tuple and a function of arity 2. It applies the two values in the tuple to the function.
examples
Examples
iex> curry({1, 2}, &Kernel.+/2)
3
flip(f)
Takes a function of arity 2 and returns the same function with its arguments in reverse order, i.e., "flipped". Please note that if a function of different arity is given, a function of arity 2 is returned where the two arguments will be applied to the given function.
examples
Examples
iex> flip(&Kernel.-/2).(3, 4)
1
uncurry(a, b, f)
Takes two values and applies them to a function or arity 1 in form of a tuple.
examples
Examples
iex> uncurry(1, 2, &(&1))
{1, 2}