KitchenSink v1.3.5 KitchenSink.Misc View Source
Link to this section Summary
Functions
Return a function which returns the nth element (zero based) of a collection which is passed to it
Link to this section Functions
Link to this function
nth(index)
View Source
nth(integer) :: (list | tuple | map -> any | no_return)
Return a function which returns the nth element (zero based) of a collection which is passed to it.
iex> f = nth(2)
iex> f.(["a", "b", "c", "d", "e"])
"c"
Utility functions first/1
, second/1
, … tenth/1
are provided as
convenient short cuts. Be aware that first/1
is really nth(0)
.
iex> third(["a", "b", "c", "d", "e"])
"c"