isSorted :: Ord a => [a] -> Bool isSorted xs = all id $ zipWith (<=) xs (tail xs) evenSquares100 = sum [ x^2 | x <- [0 .. 100], even x] prime n = n >= 2 && null [ x | x <- [2 .. n - 1], n `mod` x == 0] pairs n = [ (i, j) | i <- [0..n], even i, j <- [0..i]] foo zs = [ x + y + z | x <- [0..20], even x, let y = x * x, y < 200, Just z <- zs] example = [ (i, j) | i <- [0..2], j <- [0..1] ] ptriple x y z = x^2 + y^2 == z^2 ptriples n = [ (x,y,z) | x <- [1..n], y <- [x..n], z <- [y..n], ptriple x y z]