Created
February 18, 2009 01:57
-
-
Save travisbhartwell/66138 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| deDupItems' :: [Item] -> [Item] -> IdCountMap -> ([Item], IdCountMap) | |
| deDupItems' (item:items) keptItems seenMap = | |
| case getDeliciousUrlId item of | |
| Nothing -> deDupItems' items keptItems seenMap -- We didn't get an id, so drop it and move on | |
| Just anId -> deDupItems' items itemsToKeep (Map.insert anId (count + 1) seenMap) | |
| where | |
| count = Map.findWithDefault defaultValue anId seenMap | |
| itemsToKeep = if count > 0 then keptItems else keptItems ++ [item] | |
| deDupItems' [] keptItems seenMap = (keptItems, seenMap) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment