Proposal: adding 'tailDropWhile' to Data.List
qdunkan at gmail.com
Wed Sep 28 18:20:20 CEST 2011
On Wed, Sep 28, 2011 at 9:11 AM, Evan Laforge <qdunkan at gmail.com> wrote:
>> > 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.
>> I still argue that this is a bad idea. To an extent, functional
>> programmers tend to focus too much on lists as the be-all and end-all
>> of data structures. Whilst lists are great at what they do and
>> generally serve as a good "intermediary" data structure (e.g.
>> converting a Map k a to a Seq (k,a) ), we should not be abusing them
>> to do _everything_.
Also, as an aside, I tend to use lists for everything at first and
then convert to a more appropriate data structure later if profiling
shows a performance problem. The thing is, several times I've
switched to a theoretically more appropriate type (e.g. dlist for
repeated appends, Sequence for adds and drops from both ends,
AppendList for large appends on both ends) and performance got
significantly worse. I don't fully understand why, but my theories
are that lists have some nice properties, like 'xs++' can
immediately reduce to 'xs', and their simplicity counts for a lot
(e.g. an AppendList may have multiple pointers per element).
More information about the Libraries