Syntaxe : [E | c1,c2,...,cn] où E est une expression et ci :
[E | c1,c2,...,cn]
E
ci
p <- E1
p
E1
let p = E2
E3
Quelle est la valeur de l'expression suivante ?
[x - y | x <- [12, 9], y <- [3, 0, 6]]
[9, 12, 6, 6, 9, 3]
Aucune des réponses
Ne compile pas
[12, 9, 3, 9, 6, 0]
[9, 6, 12, 6, 3, 9]
[x y | x <- [head, null, (!!1)], y <- [[True, True], [False, True, False]]]
[True, False, False, False, True, True]
[True, False, False, True, False, True]
[True, True, False, True, False, False]
[x + 3 | x <- [1..5], x `mod` 2 == 0]
[5, 7]
[4, 5, 6, 7, 8]
[3, 5]
[x < y | x <- [3, 6, 9], y <- [0, 5, 10], (x + y) `mod` 2 == 0]
[True, True, False, False]
[True, False, True, False]
[False, True, False, True]
[y - x | x <- [5, 7, 10, 12], y <- [6, 10, 5, 20], x < y]
[1, 5, 15, 13, 3, 10, 8]
[1, 5, 15, 3, 13, 10, 8]
[1, 3, 5, 8, 10, 13, 15]