Please apply the comparison function given to nubBy to elements of the list in the order in which they occur in the list.

Christian Maeder Christian.Maeder at dfki.de
Wed Sep 21 10:00:52 CEST 2011


Am 20.09.2011 20:21, schrieb Edward Kmett:
[...]
> I would suggest you rephrase this as a formal proposal, then I can
> happily vote +1.

Seeing the "wonderful" interrelation between elem, nub, nubBy and i.e.

   unionBy eq xs ys =  xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs

   intersectBy eq xs ys =  [x | x <- xs, any (eq x) ys]

(note that "any (eq x)" could be "elemBy eq")

I see hardly a chance to make a sensible proposal.

I think, it is wrong to change the implementation of "elem" and 
"notElem" since I expect the "key" to be the first argument of the 
eq-comparison (in contrast to the REPORT_PRELUDE!).

But this all would not matter if the eq-function are always symmetric, 
which may be not the case in practise. So a change could break existing 
code.

> I'd also suggest rephrasing rhe mapAccumR as a formal proposal. I'm not
> sure yet of whether or not I'd be behind that one, but make both
> proposals separately, so they can pass individually.

I also don't see a relation to mapAccumR, so why don't you make such a 
separate proposal?

C.



More information about the Libraries mailing list