Enum

min_by/4

min_by(enumerable, fun, sort \\ &<=/2)

Returns the minimal element in the enumerable as calculated by the given fun.

By default, the comparison is done with the <= sort function. If multiple elements are considered minimal, the first one that was found is returned.

If the enumerable is empty, the provided empty_fallback is called.

The default empty_fallback raises Enum.EmptyError.