SHARE
TWEET

Untitled

a guest Oct 12th, 2017 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. group2 :: Eq a => [a] -> [[a]]
  2.  
  3. group2 [] = []
  4. group2 (h:[]) = [h]:[]
  5. group2 l = aux [] l
  6.                where aux :: Eq a => [a]-> [a] -> [[a]]
  7.                      aux a [] = [a]
  8.                      aux [] (h:t) = aux [h] t
  9.                      aux a (h:t) = if (head a) == h
  10.                                       then aux (h:a) t
  11.                                           else a: aux [h] t
RAW Paste Data
Top