RE: ++ vs comprehension

1999-10-05 Thread Simon Peyton-Jones

The latter, using the comprehension, is a bit better in GHC,
because if c' gets inlined the list comprehension might get
deforested with its consumer.  WIth an explicitly recursive c, that
won't happen.

Simon

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Monday, October 04, 1999 5:40 PM
> To: [EMAIL PROTECTED]
> Subject: ++ vs comprehension
> 
> 
> Which is better,   c []   = []
>c (xs:xss) = xs++(c xss)
> or
>c' xss = [x | xs <- xss, x <- xs]
> ?
> Which is likely to run more efficiently when composed with other 
> functions?
> 
> Thank you in advance for your explanations.
> 
> 
> --
> Sergey Mechveliani
> [EMAIL PROTECTED]
> 
> 
> 
> 
> 
> 
> 






RE: ++ vs comprehension

1999-10-04 Thread S.D.Mechveliani

No. I ask this irrelatively to  concat.  I which way comprehensions
might in principle, optimize the prigram with `++' ?