View Source Multitool.Collections.ListOperations (multitool v0.3.4)
Useful operations when dealing with Lists
Link to this section Summary
Functions
Returns a List containing all permutations of the given List
Returns a List where all elements of the given list are shifted one to the right.
Link to this section Functions
Returns a List containing all permutations of the given List
parameters
Parameters
list: The list to generate permutations of
examples
Examples
iex> permutations(["a", "b"])
[["a", "b"], ["b", "a"]]
iex> permutations([])
[[]]
Returns a List where all elements of the given list are shifted one to the right.
The last item in the List becomes the head after this operation is complete
parameters
Parameters
list: The List of items to shift one to the right
examples
Examples
iex> shift(["a", "b", "c"])
["c", "a", "b"]
iex> shift([1])
[1]