nubBy, groupBy specification
sebf at informatik.uni-kiel.de
Sat Jan 2 21:07:15 EST 2010
On Jan 3, 2010, at 1:03 AM, Cale Gibbard wrote:
> nubBy' (y:ys) xs
> | elem_by eq y xs = nubBy' ys xs
I wonder why the author of this code did not use "any (eq y)" instead
of "elem_by eq y" as "elem_by" is not exported anyway. Does "elem_by"
compile to more efficient code?
The version with "any" could be "fixed" (made equivalent to the report
version) easily by using "any (`eq` y)".
The comment on "elem_by" gives me the impression that the semantics of
"nubBy" was changed by accident in the new version and I agree that it
should be fixed.
Or maybe the semantics was changed on purpose in order to annoy people
that ignore the precondition that Cale proposes to relax (;
+1 for the relaxation.
Underestimating the novelty of the future is a time-honored tradition.
More information about the Libraries