C9 Lectures: Dr. Erik Meijer - Functional Programming Fundamentals Chapter 5 of 13
In Chapter 5, Dr. Meijer introduces and digs into List Comprehensions. In mathematics, comprehension notation is used to construct new sets from old sets. In Haskell, you can create new lists from old lists using a similar
[x^2 | x <- [1..5]]
The above notation represents the list [1,4,9,16,25] of all numbers x^2 such that x is an element of the list [1..5]. The <- [1..5] syntax is known as a
generator and list comprehensions can have mulitple generators that can have explicit dependencies on other generators. You will also learn about
guards, which restrict values created by earlier generators.
You should watch these in sequence (or skip around depending on your curent level of knowledge in this domain):