Ticket #2717 (closed proposal: invalid)
Add nubWith, nubOrd
|Reported by:||Bart Massey||Owned by:|
|Type of failure:||None/Unknown||Difficulty:||Unknown|
|Test Case:||Blocked By:|
This is a followup to my proposal #2629, which had a much more ambitious scheme. After much discussion, it was decided to put this smaller proposal on the table.
I've implemented a new function Data.List.nubWith that takes a "stop list" and "filtering function" as an argument, and filters its target list against the stop list. I've then implemented Data.Set.nubOrd in terms of nubWith. nubBy is left alone, since there's nothing obvious to be done about it. All of the nubs are still fully lazy.
Basic QuickCheck? tests have been written, and pass. Performance benchmarking shows my nubOrd implementation to be quite comparable to that of nub in cases where the latter performs well, and dramatically faster when nub performs poorly. In particular, nubOrd can work on long lists with long nubs, unlike the basic nub, which is hopeless.
Patch against current Darcs head attached.