Shared list and collection utilities.
Summary
Functions
Wraps a non-list value in a list. Returns lists unchanged.
Zips two lists, padding the shorter one with nil.
Functions
Wraps a non-list value in a list. Returns lists unchanged.
Examples
iex> Raxol.Core.Utils.List.ensure_list([1, 2])
[1, 2]
iex> Raxol.Core.Utils.List.ensure_list(:foo)
[:foo]
Zips two lists, padding the shorter one with nil.
Unlike Enum.zip/2, this does not truncate to the shorter list.
Examples
iex> Raxol.Core.Utils.List.zip_longest([1, 2, 3], [:a, :b])
[{1, :a}, {2, :b}, {3, nil}]
iex> Raxol.Core.Utils.List.zip_longest([1], [2, 3])
[{1, 2}, {nil, 3}]