projects
/
ghc-base.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2f541dc
)
Add another Data.List.intersect example from Christian Maeder
author
Ian Lynagh
<igloo@earth.li>
Fri, 27 Mar 2009 23:21:18 +0000
(23:21 +0000)
committer
Ian Lynagh
<igloo@earth.li>
Fri, 27 Mar 2009 23:21:18 +0000
(23:21 +0000)
Data/List.hs
patch
|
blob
|
history
diff --git
a/Data/List.hs
b/Data/List.hs
index
bd4e14c
..
ebee0f1
100644
(file)
--- a/
Data/List.hs
+++ b/
Data/List.hs
@@
-399,6
+399,9
@@
unionBy eq xs ys = xs ++ foldl (flip (deleteBy eq)) (nubBy eq ys) xs
-- > [1,2,3,4] `intersect` [2,4,6,8] == [2,4]
--
-- If the first list contains duplicates, so will the result.
+--
+-- > [1,2,2,3,4] `intersect` [6,4,4,2] == [2,2,4]
+--
-- It is a special case of 'intersectBy', which allows the programmer to
-- supply their own equality test.