3 ms·
That line of code was demonstrative. The actual book uses 'Data.Char.IsSpace' which properly handled it. "Returns True for any Unicode space character, and the
by zallarak 10y ago
That line of code was demonstrative. The actual book uses 'Data.Char.IsSpace' which properly handled it.
"Returns True for any Unicode space character, and the control characters \t, \n, \r, \f, \v."
Before you chastise them for not handling something, verify it. I'm not affiliated with the book but you probably deterred people from buying it.
https://github.com/BinRoot/Haskell-Data-Analysis-Cookbook/blob/master/Ch02/Code01_whitespace/Main.hs https://github.com/BinRoot/Haskell-Data-Analysis-Cookbook/bl...
- kornish 10y agoI agree that line of code was a turn-off because of its oversimplification. > That line of code was demonstrative. Why demonstrate with something completely unrepresentative of the actual contents, then?
- IanCal 10y agoWell for one the line shouldn't really be one of the first bits of advertising for the book if the author also knows it's wrong. The second example is taken from the GitHub repo for the book though, and is exactly the same type of error. > you probably deterred people from buying it. Quite possibly, but I think with good reason. I don't know what's in the book but I'm concerned it won't contain things like a discussion of what whitespace is and is not, how to decide what you should do for your data and when isSpace might not do what you really need. I can't review it properly but at least one bit of code in the repo looks dangerous and one bit on the website looks dangerous.