@@ -36,3 +36,17 @@ isElem x (y :: xs) with (decEq x y)
3636 Elem x' (y' :: xs') -> Void
3737 mkNo f g Here = f Refl
3838 mkNo f g (There x) = g x
39+
40+intersectBy : (a -> a -> Bool) -> List a -> List a -> List a
41+intersectBy _ [] _ = []
42+intersectBy _ _ [] = []
43+intersectBy eq xs ys = [x | x <- xs, any (eq x) ys]
44+
45+||| The intersect ∩ function returns the list intersect of the two lists. For example,
46+|||
47+||| ```idris example
48+||| intersect [1,2,3,4] [2,4,6,8]
49+||| ```
50+|||
51+intersect : (Eq a) => List a -> List a -> List a
52+intersect = intersectBy (==)