Corner.Tuple (corner v0.1.2)

Tuple enhance module.

Link to this section Summary

Functions

Drop number of elements from tuple.

Padding number of nil or value to head or tail of the tuple t.

Link to this section Functions

Link to this function

drop(tuple, number, at_option \\ [at: :tail])

Drop number of elements from tuple.

Default value of the :at option is :tail, mean drop elements from tail, set it to :head, drop elementes from head.

example

Example

iex> alias Corner.Tuple,as: T
iex> T.drop({:droped, :other}, 1, at: :head)
{:other}
iex> T.drop({:keep, :droped, :deopred_also}, 2)
{:keep}
Link to this function

padding(t, number, opt \\ [])

Padding number of nil or value to head or tail of the tuple t.

example

Example

iex> alias Corner.Tuple, as: T
iex> T.padding({}, 2)
{nil,nil}
iex> T.padding({:a}, 1, value: 1)
{:a, 1}
iex> T.padding({:b}, 1,value: 1, at: :head)
{1,:b}
iex> T.padding({:c}, 2, value: :e, at: :tail)
{:c, :e,:e}