Commit 17cbca82 authored by sof's avatar sof

[project @ 1997-08-25 22:24:30 by sof]

Removed use of COMPILING_GHC; removed intersectLists from export list
parent 38a2dde0
......@@ -4,28 +4,29 @@
\section[ListSetOps]{Set-like operations on lists}
\begin{code}
#ifdef COMPILING_GHC
#include "HsVersions.h"
#endif
module ListSetOps (
unionLists,
intersectLists,
--UNUSED: intersectLists,
minusList
#ifndef COMPILING_GHC
, disjointLists, intersectingLists
#endif
) where
#if defined(COMPILING_GHC)
IMP_Ubiq(){-uitous-}
import Util ( isIn, isn'tIn )
#if __GLASGOW_HASKELL__ >= 202
import List
#endif
\end{code}
\begin{code}
unionLists :: (Eq a) => [a] -> [a] -> [a]
#ifdef REALLY_HASKELL_1_3
unionLists = union
#else
unionLists [] [] = []
unionLists [] b = b
unionLists a [] = a
......@@ -33,12 +34,10 @@ unionLists (a:as) b
| a `is_elem` b = unionLists as b
| otherwise = a : unionLists as b
where
#if defined(COMPILING_GHC)
is_elem = isIn "unionLists"
#else
is_elem = elem
#endif
{- UNUSED
intersectLists :: (Eq a) => [a] -> [a] -> [a]
intersectLists [] [] = []
intersectLists [] b = []
......@@ -47,11 +46,8 @@ intersectLists (a:as) b
| a `is_elem` b = a : intersectLists as b
| otherwise = intersectLists as b
where
#if defined(COMPILING_GHC)
is_elem = isIn "intersectLists"
#else
is_elem = elem
#endif
-}
\end{code}
Everything in the first list that is not in the second list:
......@@ -59,23 +55,6 @@ Everything in the first list that is not in the second list:
minusList :: (Eq a) => [a] -> [a] -> [a]
minusList xs ys = [ x | x <- xs, x `not_elem` ys]
where
#if defined(COMPILING_GHC)
not_elem = isn'tIn "minusList"
#else
not_elem = notElem
#endif
\end{code}
\begin{code}
#if ! defined(COMPILING_GHC)
disjointLists, intersectingLists :: Eq a => [a] -> [a] -> Bool
disjointLists [] bs = True
disjointLists (a:as) bs
| a `elem` bs = False
| otherwise = disjointLists as bs
intersectingLists xs ys = not (disjointLists xs ys)
#endif
\end{code}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment