Returns a list where each item is the result of invoking fn on each corresponding item of enumerable.
Back
drop(enumerable, amount)
Front
Drops the amount of items from the enumerable from the start of the enumerable. A negative amount will drop from the end.
Back
min_max_by(enumerable, fn, fallback)
Front
Returns a tuple with the minimal and maximal element as determined by the return value of fn.
Back
What are the three data types in Elixir which are most commonly used as enumerables?
Front
List, Map, Range
Back
filter(enumerable, fn)
Front
Returns only the elements for which fn returns a truthy value.
Back
map_every(enumerable, nth, fn)
Front
Similar to map/2 except fn is only invoked on every nth element of the enumerable starting with the first element.
Back
dedup(enumerable)
Front
Returns a list where all the consecutive duplicated elements are collapsed into a single element.
Back
sort(enumerable)
Front
Sorts the enumerable according to Erlang's term ordering.
Back
drop_while(enumerable, fn)
Front
Drops every item starting from the beginning of the enumerable while fn returns a truthy value.
Back
slice(enumerable, start, amount)
Front
Returns a subset list of the given enumerable, from start with amount of elements if available.
Back
sort(enumerable, fn)
Front
Sorts the enumerable by the given function.
Back
slice(enumerable, arg)
Front
Returns a subset list of the given enumerable, from start position to index of arg.
Back
min_by(enumerable, fn, fallback)
Front
Similar to max_by/3 but returns the minimal element.
Back
join(enumerable, joiner \\ "")
Front
Joins the elements in a given enumerable into a binary (String) using joiner as a separator.
Back
chunk_by(enumerable, callback)
Front
Returns a nested list where every element is grouped together until the function returns a new value.
Back
reverse_slice(enumerable, start, count)
Front
Reverses the enumerable in the range from initial position start through count elements.
Back
concat(left, right)
Front
Concatenates the enumerable on the right with the enumerable on the left.
Back
member?(enumerable, element)
Front
Returns true if element is found in the enumerable.
Back
max_by(enumerable, fn, fallback)
Front
Returns the maximal element as determined by the return value of fn.
Back
all?(enumerable, callback \\ fn x -> x end)
Front
Returns true if the given function evaluates to true on all of the items in the enumerable.
Back
find_index(enumerable, fn)
Front
similar to find/3, but returns the index of the element instead of the element itself.
Back
reverse(enumerable)
Front
Returns a list of a element in enumerable in reverse order.
Back
empty?(enumerable)
Front
Determines if the enumerable is empty.
Back
drop_every(enumerable, nth)
Front
Drops every nth item from the enumerable starting from the first element.
Back
count(enumerable)
Front
Returns the size of the enumerable.
Back
scan(enumerable, acc, fn)
Front
Applies the given function to each element in the enumerable, storing the value in a list and then passing that value as the accumulator for the next computation.
Back
True/False:
Enum module is useful for dealing with potentially infinite enumerables.
Front
False
Back
random(enumerable)
Front
Returns a random element of an enumerable.
Back
map_join(enumerable, joiner \\ "", mapper)
Front
maps and joins the given enumerable in one pass.
Back
reduce(enumerable, fn)
Front
Invokes fn for each element in the enumerable with the accumulator.
Accumulator is defaulted to the first element in the enumerable.
Back
reduce(enumerable, acc, fn)
Front
Invokes fn for each element in the enumerable with the accumulator.
Back
into(enumerable, collectable)
Front
Inserts the elements from enumerable into a collectable which is another enumerable.
Back
scan(enumerable, fn)
Front
Similar to scan/3 but uses the first element in the enumerable as the starting accumulator.
Back
find(enumerable, default \\ nil, fn)
Front
Returns the first item for which fn returns a truthy value. If no such item is found, returns default.
Back
What is the time complexity of functions in the Enum module?
Front
O(n)
Back
fetch!(enumerable, index)
Front
Finds the element at the given index and returns it.
Throws error if index is out of bounds.
Back
min_max(enumerable, fallback)
Front
Returns a tuple with the minimal and maximal element from the enumerable as determined by Erlangs term ordering.
Back
shuffle(enumerator)
Front
Returns a list with the elements of the enumerable shuffled.
Back
at(enumerable, index, default \\ nil)
Front
Returns the element at the given index or a default value if the given index is out of range.
Back
max(enumerable, fallback)
Front
Returns the maximal element in the enumerable according to Erlang's term ordering. If the enumerable is empty, returns the value that is returned by the fallback function.
Back
reverse(enumerable, tail)
Front
Reverses the elements in enumerable, then appends the tail and returns it as a list.
Back
concat(enumerables)
Front
Given an enumerable of enumerables, concatenates the enumerables into a single list.
Back
any?(enumerable, callback \\ fn x -> x end
Front
Returns true if the given function evaluates to true on any of the items in the enumerable.
Back
fetch(enumerable, index)
Front
Finds the element at the given index and returns it in { :ok, elem } tuple.
Returns { :error } if index is out of bounds.
Back
find_value(enumerable, default \ il, fn)
Front
Similar to find/3 but returns the value of the function invocation instead of the element itself.
Back
split(enumerable, count)
Front
Returns a tuple with the enumerable split into two enumerables, leaving count elements in the first one.
Back
into(enumerable, collectable, transform)
Front
Inserts the elements from enumerable into a collectable according to the return value of the function passed into transform.
Back
flat_map(enumerable, fn)
Front
Maps the given fn over the enumerables and flattens the result one level deep.
Back
each(enumerable, fn)
Front
Invokes the given fn for each item in the enumerable.
Back
Section 2
(2 cards)
split_with(enumerable, fn)
Front
Splits the enumerable in two lists according to the given function.
Back
uniq(enumerable)
Front
Returns an enumerable sans all duplicated elements.