optimization of list comprehensions

Mats Cronqvist mats.cronqvist@REDACTED
Tue Mar 7 12:17:11 CET 2006



Richard A. O'Keefe wrote:
 > [deleted stuff]

   i can only say that i agree wholeheartedly with this.

   mats

> Now we actually have three things we are discussing here:
> 
>  - list comprehensions (and why don't we have tuple comprehensions?
>    Clean has them, and I use them a lot when writing Clean)
> 
>    We have them in Erlang, because of Mnemonsyne.
> 
>  - list walking for side effect (not needed in Haskell because there
>    aren't any side effects)
> 
>    We can get this effect simply by sticking "_ =" in front of a
>    list comprehension (or any other variable name that is clearly
>    not intended to be used again) and having a very slightly smarter
>    compiler.  I _hope_ it would not be very useful.
> 
>  - list folding (and again, tuple folding would be nice too)
>    Presumably one of the reasons that Haskell doesn't have this is
>    that Haskell has at least four different versions of fold
> 
>    This one certainly would be useful; the OTP sources could use some
>    kind of fold at least 400 times, and foldl at least 300 times.
> 
>    I think it would be advisable to check several hundred potential
>    uses of the notation before designing a concrete syntax.



More information about the erlang-questions mailing list