You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This comes down to the definition of "equivalence relation". (\a b -> a + 1 == b) is a useful equivalence relation, it's just not what the implementation expects. It would be nice if this worked as grouping consecutive elements is a fairly common thing to do.
(\a b -> a + 1 == b) is not an equivalence relation, as it is not reflexive, symmetric, or transitive. Obviously the closure of that relation would be, but that would not be useful
It may be a useful relation, but groupBy does specify an equivalence relation.
(To be clear the proposed change to operate only on successive pairs does not change behaviour if the relation is an equivalence relation and I'm happy with that change in principle)
To be clear the proposed change to operate only on successive pairs does not change behaviour if the relation is an equivalence relation and I'm happy with that change in principle
So, should the PR I have open for this #230 be accepted? Or should a new function be defined that has #230's implementation?
See https://try.purescript.org/?gist=26968458c1261226b33e574128ba9aae
For a given array like
[0, 1, 2]
, I expect thel
andr
arguments to be0
and1
1
and2
However, in the second run,
l
is0
rather than1
.I'd argue that the behavior here is unexpected.
The text was updated successfully, but these errors were encountered: