Effective Haskell - inaccurate description of filter example (page 61)

@RebeccaSkinner

On p.61 in Chapter 2, the following is described as finding “the sum of the first ten odd numbers”:

λ (foldr (+) 0 . filter odd) [0..10]
25

In fact, this code sums the odd numbers between 0 and 10 – that is, the first five odd numbers. For the sum of the first ten odd numbers, you’d probably want something like

λ (foldr (+) 0 . map (\x -> 2 * x + 1)) [0..9]
100