Re: Add lists:init/1 - got tired of implementing it

Garrett Smith <[email protected]>
Newsgroups gmane.comp.lang.erlang.patches
Message-ID <CACU=p6v7UJKc9sWCMSDk+TP5ugvw0FvSkey51f+3m-f8SNbH2w@mail.gmail.com>
On Thu, May 2, 2013 at 6:57 AM, Samuel <[email protected]> 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.

Garrett
_______________________________________________
erlang-patches mailing list
[email protected]
http://erlang.org/mailman/listinfo/erlang-patches
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.