[erlang-questions] IO efficiency
Bjorn Gustavsson
bgustavsson@REDACTED
Mon May 4 11:58:48 CEST 2009
On Sun, May 3, 2009 at 3:34 AM, Mark Selby <mark@REDACTED> wrote:
> Hi all,
>
> I'm using webmachine, and operating over a tree (node, {id, name,
> children = []}).
>
> As far as output goes, appending recursively to a list seems to make
> sense, as it contains the output in the right order. Just keep a depth
> flag going to achieve indented output.
I am not sure what you currently are doing, but if you are doing something like
PreviousOutput ++ NewStr
you should do
[PreviousOutput|NewStr]
instead to create a deep list. There is usually no need
to flatten the list as most functions that accept strings
also accept deep lists.
/Bjorn
--
Björn Gustavsson, Erlang/OTP, Ericsson AB
More information about the erlang-questions
mailing list