
2 Oct
2001
2 Oct
'01
11:52 a.m.
Dmitry Astapov wrote (on 02-10-01 15:16 +0300):
union (SL []) (SL ys) = SL ys union (SL (x:xs)) (SL ys) | member x (SL ys) = union (SL xs) (SL (x:ys)) | otherwise = union (SL xs) (SL ys)
I take it back: your implementation has a small problem in it, but nothing to do with the Eq class. The two cases in the second clause for union should be switched:
union (SL (x:xs)) (SL ys) | member x (SL ys) = union (SL xs) (SL ys) | otherwise = union (SL xs) (SL (x:ys))
-- Frank Atanassow, Information & Computing Sciences, Utrecht University Padualaan 14, PO Box 80.089, 3508 TB Utrecht, Netherlands Tel +31 (030) 253-3261 Fax +31 (030) 251-379