
28 Sep
2011
28 Sep
'11
5:44 a.m.
Hello Ivan,
I don't think that "chop" is a very good name for this kind of function; by the name, I would think more a function of type Int -> [a] -> [[a]] that "chops up" a list into sub-lists of size n. "strip" (which I presume is what you meant as your second suggestion) is a bit better...
I didn't propose to add 'chop'. I proposed to add 'tailDropWhile'.
For this kind of textual task, you _really_ should be using text anyway, and this function is already implemented for you: http://hackage.haskell.org/packages/archive/text/0.11.1.5/doc/html/Data-Text...
For real use, you are right. But to teach list programming to beginners, I think this is necessary. For instance, I would explain how to process String without regular expressions. --Kazu