Membrane Core v0.1.1 Membrane.Helper.Enum View Source

Module containing helper functions for manipulating enums.

Link to this section Summary

Functions

Same as above, returns plain result, throws match error if something goes wrong

Implementation of Enum.unzip/1 for more-than-two-element tuples. Accepts arguments

Works the same way as Enum.zip/1, but does not cut off remaining values

Link to this section Functions

Link to this function chunk_by(enum, chunker, collector) View Source
Link to this function flat_map_reduce_with(enum, acc, f) View Source
Link to this function map_reduce_with(enum, acc, f) View Source
Link to this function reduce_while_with(enum, acc, f) View Source
Link to this function reduce_with(enum, acc, f) View Source
Link to this function unzip!(list, tuple_size) View Source
unzip!([] | [...], pos_integer()) :: Tuple.t()

Same as above, returns plain result, throws match error if something goes wrong.

Link to this function unzip(list, tuple_size) View Source
unzip([] | [...], pos_integer()) :: {:ok, Tuple.t()} | {:error, any()}

Implementation of Enum.unzip/1 for more-than-two-element tuples. Accepts arguments:

  • List to be unzipped,

  • Size of each tuple in this list.

Returns {:ok, result} if there is no error.

Returns {:error, reason} if encounters a tuple of size different from tuple_size argument.

As such function is planned to be supplied in Enum module, it should replace this one once it happens.

Link to this function zip_longest(lists) View Source
zip_longest([] | [...]) :: [] | [...]

Works the same way as Enum.zip/1, but does not cut off remaining values.

Examples:

iex> x = [[1, 2] ,[3 ,4, 5]] iex> Enum.zip(x) [{1, 3}, {2, 4}] iex> zip_longest(x) [[1, 3], [2, 4], [5]]

It also returns list of lists, as opposed to tuples.