2016 Update
This commit is contained in:
parent
948b86eafa
commit
dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions
|
|
@ -20,7 +20,7 @@ hashJoin xs fx ys fy = runST $ do
|
|||
Just v -> modifySTRef' l ((map (x,) v) ++)
|
||||
readSTRef l
|
||||
|
||||
test = mapM_ print $ hashJoin
|
||||
main = mapM_ print $ hashJoin
|
||||
[(1, "Jonah"), (2, "Alan"), (3, "Glory"), (4, "Popeye")]
|
||||
snd
|
||||
[("Jonah", "Whales"), ("Jonah", "Spiders"),
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import Control.Applicative
|
|||
mapJoin xs fx ys fy = joined
|
||||
where yMap = foldl' f M.empty ys
|
||||
f m y = M.insertWith (++) (fy y) [y] m
|
||||
joined = concat . catMaybes .
|
||||
map (\x -> map (x,) <$> M.lookup (fx x) yMap) $ xs
|
||||
joined = concat .
|
||||
mapMaybe (\x -> map (x,) <$> M.lookup (fx x) yMap) $ xs
|
||||
|
||||
test = mapM_ print $ mapJoin
|
||||
main = mapM_ print $ mapJoin
|
||||
[(1, "Jonah"), (2, "Alan"), (3, "Glory"), (4, "Popeye")]
|
||||
snd
|
||||
[("Jonah", "Whales"), ("Jonah", "Spiders"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue