From: Mart Lubbers Date: Tue, 10 Feb 2015 09:11:36 +0000 (+0100) Subject: assignment 2 done X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=91eeba3cb86ab7ed5156273655217b329ab0a0b2;p=fp1415.git assignment 2 done --- diff --git a/week2/mart/StdT.icl b/week2/mart/StdT.icl index e49da8a..01bee7d 100644 --- a/week2/mart/StdT.icl +++ b/week2/mart/StdT.icl @@ -7,7 +7,7 @@ import StdEnv 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 b = a.m < b.m || a.s == b.s && a.s < b.s instance zero T where zero = {m=zero, s=zero} @@ -31,8 +31,5 @@ instance toString T where instance fromString T where fromString a - | a.[size a - 3] == ':' = {m = toInt (a % (0, (size a) - 4)), s = toInt (a % ((size a) - 3, size a))} + | a.[size a - 3] == ':' = {m = toInt (a % (0, (size a) - 4)), s = toInt (a % ((size a) - 2, size a))} | otherwise = zero - -Start :: T -Start = fromString "12:34" diff --git a/week2/mart/StdTTest b/week2/mart/StdTTest new file mode 100755 index 0000000..e4b92d6 Binary files /dev/null and b/week2/mart/StdTTest differ diff --git a/week2/mart/TupleOverloadingTest b/week2/mart/TupleOverloadingTest new file mode 100755 index 0000000..33d33e1 Binary files /dev/null and b/week2/mart/TupleOverloadingTest differ diff --git a/week2/mart/VectorOverloadingTest b/week2/mart/VectorOverloadingTest new file mode 100755 index 0000000..abf16db Binary files /dev/null and b/week2/mart/VectorOverloadingTest differ