We already have List.last/1-2

On Thu, 24 Mar 2022 06:24:24 -0700 (PDT)
Weslei Juan Novaes Pereira <weslei...@gmail.com> wrote:

> As Elixir has the `hd` and `tl` functions, it'd be very useful to
> have a `init` and `last` functions as well. For example:
> 
> last: takes a list and returns its last element.
> iex> last [5,4,3,2,1]  
> 1
> 
> init: takes a list and returns everything except its last element.
> iex> init [5,4,3,2,1]  
> [5,4,3,2]
> 

-- 
You received this message because you are subscribed to the Google Groups 
"elixir-lang-core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elixir-lang-core+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/elixir-lang-core/623d03d3.1c69fb81.7956b.42a4SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

Reply via email to