Generalize groupBy in a useful way?
Wolfgang Jeltsch
g9ks157k at acme.softbase.org
Sat Sep 6 13:02:47 EDT 2008
Am Freitag, 5. September 2008 09:06 schrieb Bart Massey:
> […]
> I think it would be better to expand the definition of of
> groupBy such that the equality test is applied only to
> adjacent elements (with the arguments in proper order).
> This would not change the behavior for true equality
> predicates, but would permit cases like incp to have
> sensible behavior, which can occasionally be useful. (It was
> to me in this case: I was identifying straights in poker
> hands.)
I think it would be better forcing the function to be an equivalence relation
using dependent types. ;-)
In the absence of dependent types, I think that noone should ever call groupBy
with a relation which is not an equivalence. So for me, it really doesn’t
matter what the function does if the precondition for calling it is not
fulfilled.
> […]
Best wishes,
Wolfgang
More information about the Libraries
mailing list