Proposal: adding 'tailDropWhile' to Data.List

Joachim Breitner mail at joachim-breitner.de
Wed Sep 28 12:58:50 CEST 2011


Hi,

Am Mittwoch, den 28.09.2011, 19:14 +0900 schrieb Kazu Yamamoto:
> > 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'?

also, it’s performance is not too bad, and definitely not as bad as
reverse: If tailDropWhile is implemented in a way that allows list
fusion (should be possible, I think), and I know that the suffix is not
large (e.g. stripping at most trailing "\n"), then tailDropWhile should
be ok to use.

Greetings,
Joachim

-- 
Joachim "nomeata" Breitner
  mail at joachim-breitner.de  |  nomeata at debian.org  |  GPG: 0x4743206C
  xmpp: nomeata at joachim-breitner.de | http://www.joachim-breitner.de/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/libraries/attachments/20110928/66abec08/attachment.pgp>


More information about the Libraries mailing list