++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Haskell supports list processing. Here are some examples of lists: > digits = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] > vowels = ['a', 'e', 'i', 'o', 'u'] > pow3 = [[], [1], [2], [3], [1, 2], [2, 3], [1, 3], [1, 2, 3]] > range1 = [-20 .. 20] > range2 = [0, 10 .. 100] ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ List concatonation: > males = ["Spiderman", "Batman", "Superman"] > females = ["Wonder Woman", "Xena", "Mom"] > heroes = males ++ females ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ We can add new elements to the front of a list using the : (cons) constructor: > heroes2 = "Captain America": heroes ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Template for list recursion: f [] = base case f (head:tail) = combine head f(tail) where combine head oldResult = newResult List Recursion: > sumList :: [Integer] -> Integer > sumList [] = 0 > sumList (a:x) = a + sumList x > squareList [] = [] > squareList (a:x) = a * a : squareList(x) > remEvens [] = [] > remEvens (a: x) > | a `mod` 2 /= 0 = a: remEvens x > | otherwise = remEvens x ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Map and Filter: > cubeList nums > = map cube nums > where > cube x = x * x * x > remOdds nums > = filter isOdd nums > where > isOdd x = x `mod` 2 /= 0 sum of even squares > soes nums > = sumList (filter even (map square nums)) > where > square x = x * x > even x = x `mod` 2 == 0 ++++++++++++++++++++++++++++++++++++++++++++++++++++ take and drop > first3 = take 3 [1..10] -- = [1, 2, 3] > last7 = drop 3 [1..10] -- = [4,5,6,7,8,9,10]