where in list comprehension haskell code example
Example: list comprehension haskell
list = [1, 2, 3, 4]
evens = [x | x <- list, even x] -- [2, 4]
mul3List = [3*x | x <- list] -- [3, 6, 9, 12]
odds = [3*x | x <- mul3List, odd (3*x)] -- [3, 9]
allCombinations = [(y, x) | x <- list, y <- list] -- [(1, 1), (1, 2) ...