ExList v0.1.2 ExList.Backends.Tuple.Utils View Source

Runtime utils to operate with ExList implemented with :tuple backend

Link to this section Summary

Functions

Function is similar to &Enum.concat/1 but not generic

Function is similar to &Enum.concat/2 but not generic

Function is similar to &Enum.reduce/3 but not generic

Function is similar to &Enum.reduce_while/3 but not generic

Function is similar to &Enum.reverse/3 but not generic

Link to this section Types

Link to this section Functions

Link to this function concat(ex_list) View Source
concat(t(t(a()))) :: t(a())

Function is similar to &Enum.concat/1 but not generic

Examples

iex> use ExList, backend: :tuple
Elixir.ExList.Backends.Tuple.Utils
iex> ex_list0 = list(1, list(2, list(3, list())))
iex> ex_list1 = list(4, list(5, list()))
iex> list(ex_list0, list(ex_list1, list())) |> ExList.concat
list(1, list(2, list(3, list(4, list(5, list())))))
Link to this function concat(ex_list0, ex_list1) View Source
concat(t(a()), t(a())) :: t(a())

Function is similar to &Enum.concat/2 but not generic

Examples

iex> use ExList, backend: :tuple
Elixir.ExList.Backends.Tuple.Utils
iex> ex_list0 = list(1, list(2, list(3, list())))
iex> ex_list1 = list(4, list(5, list()))
iex> ExList.concat(ex_list0, ex_list1)
list(1, list(2, list(3, list(4, list(5, list())))))
Link to this function reduce(arg, acc, func) View Source
reduce(t(a()), b(), (a(), b() -> b())) :: b()

Function is similar to &Enum.reduce/3 but not generic

Examples

iex> use ExList, backend: :tuple
Elixir.ExList.Backends.Tuple.Utils
iex> list(1, list(2, list(3, list()))) |> ExList.reduce(0, &(&1 + &2))
6
Link to this function reduce_while(arg, acc, func) View Source
reduce_while(
  t(a()),
  b(),
  (a(), b() -> ExList.Monads.Decision.t(b()))
) :: b()

Function is similar to &Enum.reduce_while/3 but not generic

Examples

iex> use ExList, backend: :tuple
Elixir.ExList.Backends.Tuple.Utils
iex> ex_list = list("hello", list("world", list("stop", list("please", list()))))
iex> qty = ExList.reduce_while(ex_list, 0, &((&1 == "stop") && halt(&2) || cont(&2 + 1)))
iex> "there are "<>to_string(qty)<>" words before stop..."
"there are 2 words before stop..."
Link to this function reverse(ex_list) View Source
reverse(t(a())) :: t(a())

Function is similar to &Enum.reverse/3 but not generic

Examples

iex> use ExList, backend: :tuple
Elixir.ExList.Backends.Tuple.Utils
iex> list(1, list(2, list(3, list()))) |> ExList.reverse
list(3, list(2, list(1, list())))