Last active
August 29, 2015 14:05
-
-
Save bmcorser/1a6b8bd68ff090c7de82 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:set +m | |
import qualified Data.Map | |
let phoneBook = [("betty","555-2938") | |
,("betty","342-2492") | |
,("bonnie","452-2928") | |
,("patsy","493-2928") | |
,("patsy","943-2929") | |
,("patsy","827-9162") | |
,("lucille","205-2928") | |
,("wendy","939-8282") | |
,("penny","853-2492") | |
,("penny","555-2111") | |
] | |
let phoneBookMap = Data.Map.fromList [("betty",["555-2938","342-2492"]) | |
,("bonnie",["452-2928"]) | |
,("lucille",["205-2928"]) | |
,("patsy",["493-2928","943-2929","827-9162"]) | |
,("penny",["853-2492","555-2111"]) | |
,("wendy",["939-8282"]) | |
] | |
Data.Map.fromListWith (flip (++)) [(a,[b]) | (a,b) <- phoneBook] == phoneBookMap | |
-- True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment