From: Camil Staps Date: Thu, 30 Apr 2015 13:46:25 +0000 (+0200) Subject: isequal tryouts... X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=19e299927734dbadd824b18590c3fcc7ba8f6f23;p=fp1415.git isequal tryouts... --- diff --git a/fp2/week3/camil/StdDynSet.icl b/fp2/week3/camil/StdDynSet.icl index ef6198d..2d3f95a 100644 --- a/fp2/week3/camil/StdDynSet.icl +++ b/fp2/week3/camil/StdDynSet.icl @@ -12,6 +12,13 @@ isEqual:: Dynamic t -> Bool | Set t isEqual (x :: t^) a = x == a isEqual _ _ = False +//isEqual`:: Dynamic Dynamic -> Bool | Set t +//isEqual` (x :: t^) (y :: t^) = x == y +//isEqual` _ _ = False + +isEqual`` :: Dynamic Dynamic -> Bool +isEqual`` x y = (fromJust(fromDynamic x)) == (fromJust(fromDynamic y)) + class Set a | TC, ==, toString a :: Set = Set [Dynamic] @@ -57,7 +64,7 @@ union (Set a) (Set b) = Set (a ++ b) intersection :: Set Set -> Set intersection (Set []) bs = bs intersection as (Set []) = as -intersection (Set [a:as]) (Set [(b::t):bs]) = Set [a \\ a <- as | not (dynMemberOfSet a (Set bs))] +intersection (Set [a:as]) (Set bs) = Set [a \\ a <- as | not (dynMemberOfSet a (Set bs))] without :: Set Set -> Set without a b = abort "without nog niet geimplementeerd.\n"