[Haskell-beginners] Appending to a list

Francesco Bochicchio bieffe62 at gmail.com
Sat Feb 7 15:29:39 EST 2009


Hi all,

in my haskell exercises I often build list by appending values at the end.
But I read somewhere that in haskell this is inefficient since there is no
'pointer to the tail of the list'. I've also seen some example of recursive
functions which build the list tail-first and then in the base case of the
recursion returns the reverse of the accumulated results, counting on the
fact
that in haskell 'reverse list'  just means 'consume the list from the tail'.

Just out of curiosity (I have no need to speed up my little programs with
which I try to teach myself
some haskell): is this a consolidated pattern?   And are append really
expensive?

Ciao
-------
FB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090207/e53cdee4/attachment.htm


More information about the Beginners mailing list