List comprehensions: Difference between revisions
Content deleted Content added
→{{header|AppleScript}}: Updated primitives |
→{{header|Haskell}}: Used mzero rather than [] in immediate desugaring |
||
Line 835:
and both of the above could be de-sugared to:
<lang haskell>
pyth :: Int -> [(Int, Int, Int)]
pyth n =
[1 .. n] >>=
Line 845 ⟶ 847:
case x ^ 2 + y ^ 2 == z ^ 2 of
True -> return (x, y, z)
False ->
which can be further specialised (given the particular context of the list monad, in which >>= is concatMap) to:
|