diff options
author | Camil Staps | 2017-09-13 17:59:40 +0200 |
---|---|---|
committer | Camil Staps | 2017-09-13 17:59:40 +0200 |
commit | 8f22fa5c862d9cfed2adff71309ec228c8e4aa58 (patch) | |
tree | c34dbb8d6c3351f1a2d927b38b2157b993e1642c /assignment-1 | |
parent | Assignment 1 (diff) |
foldl instead of seq+map
Diffstat (limited to 'assignment-1')
-rw-r--r-- | assignment-1/program1.icl | 4 |
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 |