Unique characters in each string: Difference between revisions
m
→{{header|Haskell}}: Inlined charCounts
m (→{{header|Haskell}}: Pruned unused imports) |
m (→{{header|Haskell}}: Inlined charCounts) |
||
Line 263:
onceInEach [] = []
onceInEach ws@(x : xs) =
S.elems $
let freq = charCounts (concat ws)▼
▲ in filter
( foldr▼
▲ ((wordCount ==) . fromJust . flip M.lookup freq)
(S.fromList
where
xs▼
wordCount = length
freq =
foldr
(flip (M.insertWith (+)) 1)▼
--------------------------- TEST -------------------------
main :: IO ()
main =
(
[ "1a3c52debeffd",
"2b6178c97a938stf",
"3ycxdb1fgxa2yz"
]</lang>
▲ foldr
▲ (flip (M.insertWith (+)) 1)
{{Out}}
<pre>123abc</pre>
|