
23 Mar
2014
23 Mar
'14
7:34 p.m.
I would keep in mind that, given the constraints
- you want to group together all equal elements from the entire list
- the only operation you can perform on elements is comparison for equality
your function will have quadratic complexity (at least I can't see any way
around it). If there's any way of sorting the elements, even if the order
is entirely arbitrary, you should consider it.
John L.
On Sat, Mar 22, 2014 at 9:51 AM, martin
Hello all,
when I groupBy a list in order to cluster elements which satisfy some sort of equality, I usually have to sort the list first, which requires Ord. However groupBy itself does not require Ord, but just Eq.
How can I groupBy a List whose elements are only instances of Eq but not of Ord?