Part of Advent of Code 2024 solution Show more
#haskell is just insanely nice and abstract sometimes:
calculateHistogram :: (Ord a, Foldable f) => f a -> Map a IntcalculateHistogram = foldr (alter (Just . (+ 1) . fromMaybe 0)) mempty
@pmidden omg, the authors invoked sexism this year for a pun? (didn't read the problem definition yet)
Mastodon server of https://doma.dev.