
22 Mar
2014
22 Mar
'14
1:40 p.m.
On Sat, Mar 22, 2014 at 11:51 PM, martin
How can I groupBy a List whose elements are only instances of Eq but not of Ord?
If you take a look at the code for groupBy: groupBy :: (a -> a -> Bool) -> [a] -> [[a]] groupBy _ [] = [] groupBy eq (x:xs) = (x:ys) : groupBy eq zs where (ys,zs) = span (eq x) xs and replace 'span' by 'partition' you'd get what you want. You'd need a new name for your different groupBy of course. -- Kim-Ee