Unique characters: Difference between revisions

Content added Content deleted
Line 586: Line 586:


uniqueChars :: [String] -> String
uniqueChars :: [String] -> String
uniqueChars xs =
uniqueChars ws =
[ k
[ k
| (k, v) <-
| (k, v) <-
M.assocs $
M.assocs $ foldr addedWord M.empty ws,
foldr
(flip (foldr (flip (M.insertWith (+)) 1)))
M.empty
xs,
1 == v
1 == v
]
]
where
addedWord = flip $ foldr updatedCharCount
updatedCharCount c = M.insertWith (+) c 1


--------------------------- TEST -------------------------
--------------------------- TEST -------------------------