> In an imperative language like Python, I'd use a dictionary as an > accumulator - something like > > for el in input: > accums[i] = accums.get(i, 0) + 1 Haskell has efficient dictionary structures too, e.g. Data.Map List.foldl' (\m x-> Map.insertWith' (+) x 1 m) Map.empty Regards, Malcolm