List comprehensions: Difference between revisions
Content added Content deleted
(→{{header|Haskell}}: Added a test to the desugared version) |
(→{{header|Haskell}}: variation of first desugaring) |
||
Line 846: | Line 846: | ||
[y .. n] >>= |
[y .. n] >>= |
||
(\z -> |
(\z -> |
||
case x ^ 2 + y ^ 2 == z ^ 2 of |
|||
True -> return (x, y, z) |
|||
False -> [])))</lang> |
|||
which can be further specialised (given the particular context of the list monad, in which >>= is concatMap) to: |
which can be further specialised (given the particular context of the list monad, in which >>= is concatMap) to: |