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

Samuel samuelrivas@REDACTED
Thu May 2 13:57:25 CEST 2013


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?

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.



More information about the erlang-patches mailing list