Skip to content
Snippets Groups Projects
Verified Commit 90136a2a authored by jonahbeneb02's avatar jonahbeneb02
Browse files

Add solutions

parent db8bcd3b
Branches main test
No related tags found
No related merge requests found
IV
(reverse . map f) xs = (map f . reverse) xs
reverse (map f xs) = map f (reverse xs)
IS
xs = (x:xs)
(reverse . map f) (x:xs)
= reverse (map f (x:xs))
= reverse (f x : (map f xs))
= reverse (map f xs) ++ [f x]
= map f (reverse xs) ++ [f x]
= map f (reverse xs) ++ map f [x]
= map f (reverse xs ++ [x])
= map f (reverse (x:xs))
= (map f . reverse) (x:xs)
data Set = Union Set Set | Intersection Set Set | Complement Set | Set Char deriving Show
deMorgan (Complement (Union a b)) = Intersection (Complement a) (Complement b)
deMorgan (Complement (Intersection a b)) = Union (Complement a) (Complement b)
deMorgan (Complement x) = Complement (deMorgan x)
deMorgan (Intersection x y) = Intersection (deMorgan x) (deMorgan y)
deMorgan (Union x y) = Union (deMorgan x) (deMorgan y)
deMorgan x = x
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment