List comprehensions: Difference between revisions

Content deleted Content added
Hout (talk | contribs)
→‎{{header|JavaScript}}: an ES6-compliant version
Hout (talk | contribs)
Line 989: Line 989:




List comprehensions were not, in the end, included in the final ES6 standard, and the code above will not run in fully ES6-compliant browsers, but we can still go straight to the underlying monadic logic of list comprehensions and obtain:
List comprehension notation was not, in the end, included in the final ES6 standard, and the code above will not run in fully ES6-compliant browsers, but we can still go straight to the underlying monadic logic of list comprehensions and obtain:


[(x,y,z) | x <- [1..n], y <- [x..n], z <- [y..n], x^2 + y^2 == z^2]
[(x,y,z) | x <- [1..n], y <- [x..n], z <- [y..n], x^2 + y^2 == z^2]