EnumExtras (enum_extras v0.1.0) View Source
Provides additional utility functions for working with enumerables.
Link to this section Summary
Functions
Calculates the average of the elements in the enumerable.
Partitions the elements of the enumerable according to the pairwise comparator.
Calculates the weighted average of the elements in the enumerable.
Link to this section Types
Specs
element() :: any()
Specs
t() :: Enumerable.t()
Link to this section Functions
Specs
Calculates the average of the elements in the enumerable.
It should return nil if the enumerable is empty.
Specs
Partitions the elements of the enumerable according to the pairwise comparator.
Examples
iex> EnumExtras.chunk_by_pairwise([1, 2, 3, 4, 1, 2, 3, 1, 2, 1], fn a, b -> a <= b end)
[[1, 2, 3, 4], [1, 2, 3], [1, 2], [1]] Specs
Calculates the weighted average of the elements in the enumerable.
It should return nil if the enumerable is empty or the weights sum to zero.