summaryrefslogtreecommitdiff
path: root/fp1/week2/mart/StdT.icl
diff options
context:
space:
mode:
authorCamil Staps2016-02-02 19:24:50 +0100
committerCamil Staps2016-02-02 19:24:50 +0100
commita7d7542dc646a5fd124ef71e71ce260889f1701b (patch)
tree04ed89503bbb3cc9933273a1326a53ca724c3492 /fp1/week2/mart/StdT.icl
parentweek6 camil: working positioning of lines by putting empties at left and righ... (diff)
Moved to 1415 directoryHEADmaster
Diffstat (limited to 'fp1/week2/mart/StdT.icl')
-rw-r--r--fp1/week2/mart/StdT.icl35
1 files changed, 0 insertions, 35 deletions
diff --git a/fp1/week2/mart/StdT.icl b/fp1/week2/mart/StdT.icl
deleted file mode 100644
index 01bee7d..0000000
--- a/fp1/week2/mart/StdT.icl
+++ /dev/null
@@ -1,35 +0,0 @@
-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.s == b.s && 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 = fromInt (toInt a - toInt b)
-
-instance toInt T where
- toInt a = a.m*60 + a.s
-instance fromInt T where
- fromInt a
- | a<0 = zero
- | otherwise = {m=a/60, s=a rem 60}
-
-instance toString T where
- toString {m=ms, s=0} = toString ms +++ ":00"
- toString {m=ms, s=ss}
- | ss < 10 = toString ms +++ ":0" +++ toString ss
- | otherwise = toString ms +++ ":" +++ toString ss
-
-instance fromString T where
- fromString a
- | a.[size a - 3] == ':' = {m = toInt (a % (0, (size a) - 4)), s = toInt (a % ((size a) - 2, size a))}
- | otherwise = zero