[erlang-patches] Add lists:init/1 - got tired of implementing it

Garrett Smith <>
Thu May 2 14:32:08 CEST 2013

On Thu, May 2, 2013 at 6:57 AM, Samuel <> wrote:
> If I understand correctly, the reason to add this function is not
> performance. So the discussion about whether to add it or not should
> verse around whether it makes sense to have that functionality in the
> standard library. Once decided it makes sense, then the discussion
> about performance is relevant, but not before.
> Also, when discussing whether this function is useful or not, I don't
> find particularly constructive talking about higher level use cases
> than plainly "getting the last N elements of a list". lists is a very
> generic purpose library, we cannot play the game here of assessing all
> possible uses of it. Programs may be using lists efficiently but have
> an infrequent corner use where it is ok to access them inefficiently
> instead of complicating the whole implementation, or maybe is a
> prototype, or maybe is useful while debugging in the shell, etc.
> For me the important questions, once knowing that at least someone has
> a need for this, are:
>   * Is it generic or couples lists with external application logic?
>   * Does it clutter the api?
>   * Does it make sense along with other functions in the api?
>   * Does it encourage any particularly dangerous use pattern?

These are arguments for *why not* to add a function. I think for a
module that's as central as lists, the argument must be *why must*.

> IMO, the proposed function with two arguments passes that filter, but
> I cannot judge whether the effort of implementing and maintaining it
> pays off for OTP.

I'd love to hear from someone why we need the semantic sugar of
drop_last or drop_nth_last on top of sublist.


More information about the erlang-patches mailing list