List comprehensions: Difference between revisions

m
→‎{{header|Haskell}}: (white space adjustment)
m (→‎{{header|Haskell}}: (>>=) is flip concatMap)
m (→‎{{header|Haskell}}: (white space adjustment))
Line 828:
pyth :: Int -> [(Int, Int, Int)]
pyth n = do
x <- [1 .. n]
y <- [x .. n]
z <- [y .. n]
guard $ x ^ 2 + y ^ 2 == z ^ 2
return (x, y, z)</lang>
 
and both of the above could be de-sugared to:
9,659

edits