2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
4 \section[ListSetOps]{Set-like operations on lists}
9 --UNUSED: intersectLists,
14 #include "HsVersions.h"
16 import Util ( isIn, isn'tIn )
21 unionLists :: (Eq a) => [a] -> [a] -> [a]
22 #ifdef REALLY_HASKELL_1_3
29 | a `is_elem` b = unionLists as b
30 | otherwise = a : unionLists as b
32 is_elem = isIn "unionLists"
36 intersectLists :: (Eq a) => [a] -> [a] -> [a]
37 intersectLists [] [] = []
38 intersectLists [] b = []
39 intersectLists a [] = []
40 intersectLists (a:as) b
41 | a `is_elem` b = a : intersectLists as b
42 | otherwise = intersectLists as b
44 is_elem = isIn "intersectLists"
48 Everything in the first list that is not in the second list:
50 minusList :: (Eq a) => [a] -> [a] -> [a]
51 minusList xs ys = [ x | x <- xs, x `not_elem` ys]
53 not_elem = isn'tIn "minusList"