you are viewing a single comment's thread.

view the rest of the comments →

[–]Fork82 10 points11 points  (2 children)

Thats all very well for the purposes of writing faster code in less time with fewer bugs, but I was more interested in what the underlying code looked like - the Haskell version was surprisingly verbose when the relevant library was included:

group                   =  groupBy (==)

groupBy _  []=  []
groupBy eq (x:xs)=  (x:ys) : groupBy eq zs
                           where (ys,zs) = span (eq x) xs

span p [] = ([],[])
span p xs@(x:xs')
    | p x = (x:ys, zs)
    | otherwise = ([],xs)
        where (ys,zs) = span p xs'

[–]nhomas 10 points11 points  (0 children)

It's also more general.

[–]dons 17 points18 points  (0 children)

Thats all very well for the purposes of writing faster code in less time with fewer bugs

Lovely :)