List.flatten
You're seeing just the function
flatten
, go back to List module for more information.
Specs
Flattens the given list
of nested lists.
Empty list elements are discarded.
Examples
iex> List.flatten([1, [[2], 3]])
[1, 2, 3]
iex> List.flatten([[], [[], []]])
[]
Specs
flatten(deep_list, [elem]) :: [elem] when deep_list: [elem | deep_list], elem: var
Flattens the given list
of nested lists.
The list tail
will be added at the end of
the flattened list.
Empty list elements from list
are discarded,
but not the ones from tail
.
Examples
iex> List.flatten([1, [[2], 3]], [4, 5])
[1, 2, 3, 4, 5]
iex> List.flatten([1, [], 2], [3, [], 4])
[1, 2, 3, [], 4]