[erlang-questions] how: Another library flatten function?

黃耀賢 (Yau-Hsien Huang) g9414002.pccu.edu.tw@REDACTED
Sat Feb 27 14:19:42 CET 2010


The basic concept of flattening a list, similar to process a binary tree, is
to flatten the head
elements which may be a list or not, to flatten the tail which is a list,
and to concatenate
these two parts. How to make a flattening function tail-recursive?


2010/2/27 Dmitry Belayev <rumata-estor@REDACTED>

> Shame on me, my own version uses f(_, f(_)) so it is not-tail recursive
> too.
>
>
> Dmitry Belayev wrote:
>
>>
>> It would be best solution in non-strict language like haskell, but in
>> erlang it is not tail-recursive, so it will use more memory.
>>
>>


More information about the erlang-questions mailing list