software-engineering-amsterdam / ST2018_WG_9

2 stars 0 forks source link

Lab 4 #2

Open BertLisser opened 6 years ago

BertLisser commented 6 years ago

Exercise 6

(@@) :: Eq a => Rel a -> Rel a -> Rel a
(Set r) @@ (Set s) = Set $ nub [ (x,z) | (x,y) <- r, (w,z) <- s, y == w ]

is wrong. Must be

(@@) :: Eq a => Rel a -> Rel a -> Rel a
(Set r) @@ (Set s) = Set $ sort.nub [ (x,z) | (x,y) <- r, (w,z) <- s, y == w ]

This error makes also this definition wrong

trClos :: Ord a => Rel a -> Rel a
trClos set = apprx [foldl1 unionSet (take n rs) | n <- [1..]] 
           where rs             = iterate (set @@) set
                 apprx (x:y:zs) = if x == y then x else apprx (y:zs)

The call of sort is missing