[erlang-patches] Add lists:init/1 - got tired of implementing it
Hans Svensson
hanssv@REDACTED
Thu May 2 08:08:28 CEST 2013
Hi,
The most typical use case, for me, is when using either filename:split
or string :tokens to create a list of elements where the last element is
not needed. I.e. this is in some sense a generalization of
filename:dirname/1 (which I bet has something like this in its
implementation...)
I have also seen this exact use is in lib/ssh/src/ssh_sftpd.erl in otp ;-)
Also, when handling a failing test case, which consists of a list of
commands, it is useful to treat the successful commands (init(Commands))
differently from the failing command (last(Commands)).
I have personally never missed the 'remove N last elements'-function.
Cheers,
Hans
On 2013-04-30 12:05, Siri Hansen wrote:
> We haven't yet made any decision regarding this patch, but we have had
> some discussions in the team and we are not totally convinced about
> the general need for this function. Thus we would appreciate some
> input from the list.
>
> So - disregarding the name and the implementation for a second - is
> this functionality a good addition to the lists module? Is it often
> needed?
>
> If so, would it be even better to do a more general version which
> removes the N last elements from the list?
>
> Hans, could you also possibly describe some of your use cases?
>
> Regards
> siri@REDACTED
>
>
> 2013/4/29 Fredrik <fredrik@REDACTED <mailto:fredrik@REDACTED>>
>
> On 04/25/2013 05:12 PM, Hans Svensson wrote:
>
> git fetch git://github.com/hanssv/otp.git
> <http://github.com/hanssv/otp.git> add_init_to_lists
>
> Fetched, it is currently located in the 'pu' branch.
> A review process has started.
> Thanks,
>
> --
>
> BR Fredrik Gustafsson
> Erlang OTP Team
>
>
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED <mailto:erlang-patches@REDACTED>
> http://erlang.org/mailman/listinfo/erlang-patches
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20130502/5a76de55/attachment.htm>
More information about the erlang-patches
mailing list