summaryrefslogtreecommitdiff
path: root/fp1/week4/mart
diff options
context:
space:
mode:
Diffstat (limited to 'fp1/week4/mart')
-rw-r--r--fp1/week4/mart/5.4.txt4
-rw-r--r--fp1/week4/mart/StdSet.dcl25
-rw-r--r--fp1/week4/mart/StdSet.icl54
3 files changed, 0 insertions, 83 deletions
diff --git a/fp1/week4/mart/5.4.txt b/fp1/week4/mart/5.4.txt
deleted file mode 100644
index 50521d3..0000000
--- a/fp1/week4/mart/5.4.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-1. 4+2 en 2+4. Dit geeft zelfde uitkomst ivm commutativiteit van +
-2. 4-2 en 2-4. Dit geeft 2 en -2. - is niet commutitatief.
-3. 4*2 en 2*4. Dit geeft zelfde uitkomst ivm commutativiteit van *
-4. 4/2 en 2/4. Dit geeft 2 en 0. / is niet commutitatief.
diff --git a/fp1/week4/mart/StdSet.dcl b/fp1/week4/mart/StdSet.dcl
deleted file mode 100644
index 0c702ca..0000000
--- a/fp1/week4/mart/StdSet.dcl
+++ /dev/null
@@ -1,25 +0,0 @@
-definition module StdSet
-
-import StdClass
-
-:: Set a
-
-toSet :: [a] -> Set a | Eq a
-fromSet :: (Set a) -> [a]
-
-isEmptySet :: (Set a) -> Bool
-isDisjoint :: (Set a) (Set a) -> Bool | Eq a
-isSubset :: (Set a) (Set a) -> Bool | Eq a
-isStrictSubset :: (Set a) (Set a) -> Bool | Eq a
-memberOfSet :: a (Set a) -> Bool | Eq a
-union :: (Set a) (Set a) -> Set a | Eq a
-intersection :: (Set a) (Set a) -> Set a | Eq a
-nrOfElements :: (Set a) -> Int
-without :: (Set a) (Set a) -> Set a | Eq a
-
-product :: (Set a) (Set b) -> Set (a,b)
-
-instance zero (Set a)
-instance == (Set a) | Eq a
-
-powerSet :: (Set a) -> Set (Set a) | Eq a
diff --git a/fp1/week4/mart/StdSet.icl b/fp1/week4/mart/StdSet.icl
deleted file mode 100644
index ecb2e60..0000000
--- a/fp1/week4/mart/StdSet.icl
+++ /dev/null
@@ -1,54 +0,0 @@
-implementation module StdSet
-
-import StdEnv
-import StdClass
-
-:: Set a = Set [a]
-
-toSet :: [a] -> Set a | Eq a
-toSet s = Set (removeDup s)
-
-fromSet :: (Set a) -> [a]
-fromSet (Set s) = s
-
-isEmptySet :: (Set a) -> Bool
-isEmptySet s = isEmpty (fromSet s)
-
-isDisjoint :: (Set a) (Set a) -> Bool | Eq a
-isDisjoint s1 s2 = nrOfElements (intersection s1 s2) == 0
-
-isSubset :: (Set a) (Set a) -> Bool | Eq a
-isSubset s1 s2 = nrOfElements s1 == nrOfElements (intersection s1 s2)
-
-isStrictSubset :: (Set a) (Set a) -> Bool | Eq a
-isStrictSubset s1 s2 = isSubset s1 s2 && nrOfElements s1 < nrOfElements s2
-
-memberOfSet :: a (Set a) -> Bool | Eq a
-memberOfSet a (Set []) = False
-memberOfSet a (Set [x:xs]) = a == x || memberOfSet a (Set xs)
-
-union :: (Set a) (Set a) -> Set a | Eq a
-union (Set s1) (Set s2) = toSet (s1 ++ s2)
-
-intersection :: (Set a) (Set a) -> Set a | Eq a
-intersection (Set s1) s2 = Set [e \\ e <- s1 | memberOfSet e s2]
-
-nrOfElements :: (Set a) -> Int
-nrOfElements s = length (fromSet s)
-
-without :: (Set a) (Set a) -> Set a | Eq a
-without (Set s1) s2 = Set [e \\ e <- s1 | not (memberOfSet e s2)]
-
-product :: (Set a) (Set b) -> Set (a,b)
-product (Set s1) (Set s2) = Set [(e1, e2) \\ e1 <- s1, e2 <- s2]
-
-instance zero (Set a)
-where zero = Set []
-
-instance == (Set a) | Eq a
-where (==) s1 s2 = isSubset s1 s2 && isSubset s2 s1
-
-powerSet :: (Set a) -> Set (Set a) | Eq a
-powerSet (Set []) = Set [(Set [])]
-powerSet (Set [e:xs]) = union (powerSet (Set xs))
- (Set [union (Set [e]) x \\ x <- fromSet (powerSet (Set xs))])