factor :: (Ord a) => [(a, b)] -> [(a, [b])]
factor abs_ = case abs_ of
    []       -> []
    (k, _):_ -> let (abs1, abs2) = span (\a -> fst a == k) abs_
                 in (k, map snd abs1):factor abs2
factor :: (Ord a) => [(a, b)] -> [(a, [b])]
factor abs_ = case abs_ of
    []       -> []
    (k, _):_ -> let (abs1, abs2) = span (\a -> fst a == k) abs_
                 in (k, map snd abs1):factor abs2
factor abs_ = case abs_ of
    []       -> []
    (k, _):_ -> let (abs1, abs2) = span (\a -> fst a == k) abs_
                 in (k, map snd abs1):factor abs2