Created
January 23, 2009 11:59
-
-
Save travisbhartwell/50987 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
eDupItems' :: [Item] -> [Item] -> IdCountMap -> [Item] | |
deDupItems' (item:items) keptItems seenMap = | |
case delId 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] | |
where | |
delId = getDeliciousUrlId item | |
deDupItems' [] keptItems seenMap = keptItems |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment