On Saturday, 2003-06-21, 14:38, CEST, Mark Carroll wrote:
> I am assembling a list from start to end. I can add elements to the end with
> "previous ++ [current]" or I can add them with "current : previous" and
> reverse it when I'm done. Or, maybe I should use some other data structure.
> (I don't know the length in advance.) Any thoughts?
>
> -- Mark

Hi,

adding with "current : previous" and finally reversing the list seems good 
since the whole process takes linear time whereas adding to the end with 
"previous ++ [current]" would take quadratic time.

Wolfgang

_______________________________________________
Haskell-Cafe mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to