Proposal: adding 'tailDropWhile' to Data.List

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Sep 28 12:14:54 CEST 2011


> In my opinion, teaching students to do a large amount of "fiddling"
> with the ends of lists is getting them used to bad habits.  If you
> _really_ need to do a lot of stuff at the end of a list-like data
> structure, use a Seq or something.

My tutorial introduced trees and combinators also. ;-)

Also, I would point out that even "Real World Haskell" starts with a
list.

> If you still want to use this to teach students (maybe because you're
> building them up to "but in general you shouldn't do this") then
> provide this function for their use elsewhere (either as something to
> copy/paste, or an auxiliary library for your class).  But I don't
> think it belongs in Data.List.

So, what about 'reverse'? 

Both 'reverse' and 'tailDropWhile' are inefficient.
Data.List has 'reverse'. Why not 'tailDropWhile'?

P.S.

I don't think students who do not understand lists can understand
trees.

--Kazu



More information about the Libraries mailing list