Skip to content

Instantly share code, notes, and snippets.

@shigemk2
Created February 18, 2015 12:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shigemk2/fbe412c3f45c59551d04 to your computer and use it in GitHub Desktop.
Save shigemk2/fbe412c3f45c59551d04 to your computer and use it in GitHub Desktop.
import qualified Data.Map as Map
main = do
print $ Map.fromListWith max [(2,3),(2,5),(2,100),(3,29),(3,22),(3,11),(4,22),(4,15)] -- fromList [(2,100),(3,29),(4,22)]
print $ Map.fromListWith (+) [(2,3),(2,5),(2,100),(3,29),(3,22),(3,11),(4,22),(4,15)] -- fromList [(2,108),(3,62),(4,37)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment