optimization of list comprehensions

Thomas Johnsson thomas@REDACTED
Fri Mar 10 14:02:56 CET 2006


Hm yes, "small is beautiful" is true perhaps more often than one might 
think....
perhaps a useful middle of the road approach would be to provide 
efficient looping implementation of the following pattern
    lists:foldl(fun(..pat...)-> ... expr.. end, Z, [ list 
comprehension....] )
and also point that out in the documentation.

As an example of "the whole shebang", ie a (purely!) functional language 
that has a loop construct, c.f. Id, see
http://csg.csail.mit.edu/pubs/publications.html ,
later included in pH (parallel Haskell).

Accumulating array comprehensions, anyone?
-- Thomas



Mats Cronqvist wrote:

>
>
> Richard A. O'Keefe wrote:
>
>> [...]   
>> If funs are not used when they are *appropriate*, then it isn't
>> "perfectly fine" Erlang.
>
>
>   appropriateness is in the eye of the beholder.
>
>> [...]
>> Remember, language features don't come free.
>> *Someone* has to design them.
>> *Someone* has to implement them.
>> *Someone* has to document them.
>> *Someone* has to revised training materials.
>> This is more effort than you might think, so it had better have a
>> high enough payoff.  If it is you doing all these things, then it's
>> entirely up to your judgement whether to do it.  If you are asking
>> other people to do them for you, you had better give them good reasons.
>
>
>   i'm well aware that new features don't come free. as a matter of 
> fact, i could find out exactly how much it would cost.
>   if i was certain that new notation would improve our product, i 
> would be having this discussion directly with OTP. as it is, i'm a bit 
> discouraged after noticing how little use of list comprehensions there 
> actually is.
>
>   mats
>





More information about the erlang-questions mailing list