by alexmolas · 2y ago · 0 comments
Can you elaborate on that? I don't see how grouping can be a non-deterministic computation. When you compute the groups of a set you always get the same ones, or am I missing something?
The groups are deterministic. The non-determinism lies in which element of the group is then selected.
"Calculate an even number"
equals
"Take any element from the group of even numbers"
https://www.schoolofhaskell.com/school/starting-with-haskell...
Anecdote time: some weeks ago I had a bug for this reason. I was doing a groupby + select the first element, and since the first element is not always the same I was getting some weird results. I solved it by sorting the group elements before selecting the first element.