Errata

 
 

This page lists the errata in page order, whereas the blog will issue new errata notices as and when they are discovered.


Thanks very much to Greg Bowen, Christian Fricke, Daniel Kröni, Patrick Lynch, Hua Ming, Joshua Nahum and Carlos Suberviola Oroz for pointing out these errors.


Page 51


The definition of max' says:


    max' x yMax


it should be:


    max' x y


Pages 56 and 111


These pages contain  examples of using


    read


to turn a string into a value. If you type these to the ghci prompt then a type annotation is needed, but that’s not always true in general, as seen in the example here:


    Prelude> (read "True") && False

    False


where the context of the read expression supplies the required type.


Page 72


The image at the start of Section 4.2 should be as below. This image is also referred to by Exercises 4.5 to 4.7.

   













Page 97


In the introductory section to Chapter 5,  “ … list processing functions, aw well as … “ should be “ … list processing functions, as well as … “.


Page 182


Line 11 refers to


    (inputDiff.1)


this should be:


    (inputDiff)


Page 182


Line 8 refers to ‘different’; it should say ‘difference’.


Page 191


Line -1 ‘jusy’ should say ‘just’.


Page 192


In the definition of playInteractive we use the “as pattern”


    t@(mine,yours)


which has the same effect as using the pattern (mine,yours) but also matching the whole pattern by t. This notation is explained in detail in the box on p384.


Page 208


The final equation in this exercise should read


    flipH (flipH pic) = pic


Page 208


The output at the foot of the page should be "Freak Out !" not "Freak Out!"


Page 231


The second last paragraph is missing a "we": ...setting the scene for Chapter 12 where _ will put these...


Page 232


The fourth paragraph contains an unfinished sentence:  ... passing the output of one to the input of another, and it is _. Should stop after “another” with a full stop.


Page 235


The function mentioned here should be


    produceBill


as discussed at the foot of page 148.


Page 268


Word correction from you to your: “Hint: you may want to model you(r) definition”.


Page 269


The exercise asks you to write a function


    train :: Moves -> [Strategy] -> Strategy


this should be:


    train :: [Move] -> [Strategy] -> Strategy


Page 271


The function type given here should be


    splits :: [a] -> [([a],[a])]


Page 390


The function addMessage should be defined like this


    addMessage im (QS time serv ml)

      | isYes im            = QS time serv (ml++[im])

      | otherwise           = QS time serv ml

        where

        isYes (Yes _ _)     = True

        isYes _             = False


so that “No” messages are not included in the queue, since the queueStep function doesn’t process them.


Page 394


The API for search trees here is missing the function of checking whether a value is an element of the tree:


    elemT :: Ord a => a -> Tree a -> Bool