[Haskell-cafe] Statements spanning multiple lines?

Daniel Carrera daniel.carrera at zmsl.com
Thu Dec 22 13:03:37 EST 2005


Greg Buchholz wrote:
>     You might also like to try the slightly more efficient...
> 
> pyth n = [(a,b,c) | a <- [1..n],      
>                     b <- [a..n],       
>                     c <- [a+1..n],     
>                     a*a + b*b == c*c ]

Cool. I'm amazed that actually works. I've been writing filters upon 
filters in all my functions because I didn't realize you could write 
things like that.

Cheers,
Daniel.
-- 
      /\/`) http://oooauthors.org
     /\/_/  http://opendocumentfellowship.org
    /\/_/
    \/_/    I am not over-weight, I am under-tall.
    /


More information about the Haskell-Cafe mailing list