Tuple
Functions for working with tuples.
Summary
| delete_at(tuple, index) | Remove an element from a tuple |
| duplicate(data, size) | Create a new tuple |
| insert_at(tuple, index, term) | Insert an element into a tuple |
Functions
Specs:
- delete_at(tuple, non_neg_integer) :: tuple
Remove an element from a tuple.
Deletes the element at the zero-based index from tuple.
Raises an ArgumentError if index is greater than
or equal to the length of tuple.
Examples
iex> tuple = { :foo, :bar, :baz }
...> Tuple.delete_at(tuple, 0)
{ :bar, :baz }
Specs:
- duplicate(term, non_neg_integer) :: tuple
Create a new tuple.
Creates a tuple of size size containing the
given data at every position.
Examples
iex> Tuple.duplicate(:hello, 3)
{ :hello, :hello, :hello }
Specs:
- insert_at(tuple, non_neg_integer, term) :: tuple
Insert an element into a tuple.
Inserts value into tuple at the given zero-based index.
Raises an ArgumentError if index is greater than the
length of tuple.
Examples
iex> tuple = { :bar, :baz }
...> Tuple.insert_at(tuple, 0, :foo)
{ :foo, :bar, :baz }