Optimize some ++ situations

Christofer Tornkvist (ctornkvi) ctornkvi@REDACTED
Tue Oct 27 17:08:58 CET 2020


Hi,

would it be a stupid suggestion to let add a parameter of list type
to all built-in and library functions returning a list.

The additional list parameter will represent a list-tail that will be appended to the result.
Append would be accomplished by  [ ListResult| MyTail ].

If this was the case, the complier can optimize code like;
erlang:atom_to_list(Atom) ++ MyTail
into
erlang:atom_to_list(Atom, MyTail)

or

lists:map(Fun, List) ++ MyTail
into
lists:map(Fun, List, MyTail)


Or is the compiler able to see this optimization anyhow?

Cheers!
/Christofer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20201027/97dd5dda/attachment.htm>


More information about the erlang-questions mailing list