summaryrefslogtreecommitdiff
path: root/assignment-1
diff options
context:
space:
mode:
authorCamil Staps2017-09-13 17:59:40 +0200
committerCamil Staps2017-09-13 17:59:40 +0200
commit8f22fa5c862d9cfed2adff71309ec228c8e4aa58 (patch)
treec34dbb8d6c3351f1a2d927b38b2157b993e1642c /assignment-1
parentAssignment 1 (diff)
foldl instead of seq+map
Diffstat (limited to 'assignment-1')
-rw-r--r--assignment-1/program1.icl4
1 files changed, 2 insertions, 2 deletions
diff --git a/assignment-1/program1.icl b/assignment-1/program1.icl
index 79e9102..611894f 100644
--- a/assignment-1/program1.icl
+++ b/assignment-1/program1.icl
@@ -2,7 +2,7 @@ module program1
import StdBool
import StdEnum
-from StdFunc import flip, o, seq
+from StdFunc import flip, o
import StdList
import StdString
import StdTuple
@@ -60,7 +60,7 @@ instance serialize [a] | serialize a
where
// We don't actually need to start with [, but this gives some type safety.
// The ] is necessary to recognise the end of the list.
- write xs c = write "[" (seq (map write xs) (write "]" c))
+ write xs c = write "[" (foldl (flip write) (write "]" c) xs)
read ["[":r] = readElements [] r
where
readElements :: [a] [String] -> Maybe ([a], [String]) | serialize a