Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab 4 #2

Open
BertLisser opened this issue Oct 8, 2018 · 0 comments
Open

Lab 4 #2

BertLisser opened this issue Oct 8, 2018 · 0 comments

Comments

@BertLisser
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant