Realm v0.1.0 Realm.Monoid.Algebra View Source

Link to this section Summary

Functions

map with its arguments flipped.

Check if a value is the empty element of that type.

Link to this section Functions

Link to this function

across(fun, functor)

View Source
across((any() -> any()), Realm.Functor.t()) :: Realm.Functor.t()

map with its arguments flipped.

Examples

iex> import Realm.Monoid.Algebra
...> across(fn x -> x + 1 end, [1, 2, 3])
[2, 3, 4]
iex> import Realm.Monoid.Algebra
...> fn
...>   int when is_integer(int) -> int * 100
...>   value -> inspect(value)
...> end
...> |> .across(%{a: 2, b: [1, 2, 3]})
%{a: 200, b: "[1, 2, 3]"}

Check if a value is the empty element of that type.

Examples

iex> import Realm.Monoid.Algebra
...> empty?([])
true
iex> import Realm.Monoid.Algebra
...> empty?([1])
false