diff options
author | Camil Staps | 2016-02-02 19:24:50 +0100 |
---|---|---|
committer | Camil Staps | 2016-02-02 19:24:50 +0100 |
commit | a7d7542dc646a5fd124ef71e71ce260889f1701b (patch) | |
tree | 04ed89503bbb3cc9933273a1326a53ca724c3492 /fp1/week2/camil/StdT.icl | |
parent | week6 camil: working positioning of lines by putting empties at left and righ... (diff) |
Diffstat (limited to 'fp1/week2/camil/StdT.icl')
-rw-r--r-- | fp1/week2/camil/StdT.icl | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/fp1/week2/camil/StdT.icl b/fp1/week2/camil/StdT.icl deleted file mode 100644 index 03c8645..0000000 --- a/fp1/week2/camil/StdT.icl +++ /dev/null @@ -1,37 +0,0 @@ -/**
- * Mart Lubbers, s4109503
- * Camil Staps, s4498062
- */
-
-implementation module StdT
-
-import StdEnv
-
-:: T = {m :: Int, s :: Int}
-
-instance == T where == a b = a.m == b.m && a.s == b.s
-instance < T where < a b = a.m < b.m || a.m == b.m && a.s < b.s
-
-instance zero T where zero = {m = zero, s = zero}
-instance + T where + a b = fromInt (toInt a + toInt b)
-instance - T where - a b = if (a < b) zero (fromInt (toInt a - toInt b))
-
-instance toInt T where toInt a = a.m * 60 + a.s
-instance fromInt T where fromInt n = if (n < 0) zero {m = n/60, s = n rem 60}
-
-instance toString T where
- toString {m = x, s = 0} = toString x +++ ":00"
- toString a = toString a.m +++ ":" +++ (if (a.s < 10) "0" "") +++ toString a.s
-instance fromString T where
- fromString s = if (s.[size s - 3] == ':')
- {m = toInt (s % (0, size s - 4)), s = toInt (s % (size s - 2, size s - 1))}
- zero
-
-Start :: (Bool, Bool, T, T, T, Int, String, T, T)
-Start = (LOTR == Tea, Tea < LOTR,
- zero + LOTR, LOTR + Tea, Tea - LOTR,
- toInt LOTR, toString Tea,
- fromString "5:40", fromString "foo")
-
-LOTR = {m=178, s=0}
-Tea = {m=0,s=41}
|