[Haskell-cafe] appending an element to a list

Adrian Neumann aneumann at inf.fu-berlin.de
Thu May 29 13:04:08 EDT 2008


Hello,

I was wondering how expensive appending something to a list really is. 
Say I write

I'd say "longList ++ [5]" stays unevaluated until I consumed the whole 
list and then appending should go in O(1). Similarly when concatenating 
two lists.

Is that true, or am I missing something?

Adrian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 250 bytes
Desc: OpenPGP digital signature
Url : http://www.haskell.org/pipermail/haskell-cafe/attachments/20080529/ecc04498/signature.bin


More information about the Haskell-Cafe mailing list