summaryrefslogtreecommitdiff
path: root/fp2/week1
diff options
context:
space:
mode:
authorCamil Staps2016-02-02 19:24:50 +0100
committerCamil Staps2016-02-02 19:24:50 +0100
commita7d7542dc646a5fd124ef71e71ce260889f1701b (patch)
tree04ed89503bbb3cc9933273a1326a53ca724c3492 /fp2/week1
parentweek6 camil: working positioning of lines by putting empties at left and righ... (diff)
Moved to 1415 directoryHEADmaster
Diffstat (limited to 'fp2/week1')
-rw-r--r--fp2/week1/camil/Galgje.icl58
-rw-r--r--fp2/week1/camil/Random.dcl19
-rw-r--r--fp2/week1/camil/Random.icl20
-rw-r--r--fp2/week1/camil/SimpleFileIO.dcl14
-rw-r--r--fp2/week1/camil/SimpleFileIO.icl39
-rw-r--r--fp2/week1/camil/StdMaybe.dcl41
-rw-r--r--fp2/week1/camil/StdMaybe.icl65
-rw-r--r--fp2/week1/camil/lexicon.txt18
-rw-r--r--fp2/week1/camil/round-0.txt7
-rw-r--r--fp2/week1/camil/round-1.txt7
-rw-r--r--fp2/week1/camil/round-2.txt7
-rw-r--r--fp2/week1/camil/round-3.txt7
-rw-r--r--fp2/week1/camil/round-4.txt7
-rw-r--r--fp2/week1/camil/round-5.txt7
-rw-r--r--fp2/week1/camil/round-lost.txt7
-rw-r--r--fp2/week1/camil/week1.tar.gzbin3450 -> 0 bytes
-rwxr-xr-xfp2/week1/mart/Echobin103744 -> 0 bytes
-rw-r--r--fp2/week1/mart/Echo.icl11
-rwxr-xr-xfp2/week1/mart/Galgjebin103512 -> 0 bytes
-rw-r--r--fp2/week1/mart/Galgje.icl13
-rw-r--r--fp2/week1/mart/GalgjeWF.dcl5
-rw-r--r--fp2/week1/mart/Random.dcl19
-rw-r--r--fp2/week1/mart/Random.icl20
-rwxr-xr-xfp2/week1/mart/RandomGetallenbin105976 -> 0 bytes
-rw-r--r--fp2/week1/mart/RandomGetallen.dcl7
-rw-r--r--fp2/week1/mart/RandomGetallen.icl33
-rw-r--r--fp2/week1/mart/SimpleFileIO.dcl14
-rw-r--r--fp2/week1/mart/SimpleFileIO.icl39
28 files changed, 0 insertions, 484 deletions
diff --git a/fp2/week1/camil/Galgje.icl b/fp2/week1/camil/Galgje.icl
deleted file mode 100644
index 75b09d0..0000000
--- a/fp2/week1/camil/Galgje.icl
+++ /dev/null
@@ -1,58 +0,0 @@
-// Mart Lubbers s4109503, Camil Staps s4498062
-
-module Galgje
-
-import StdEnv, SimpleFileIO, RandomGetallen
-
-lexicon_file = "lexicon.txt"
-
-// Is a Char a member of a String
-isMemberString :: String Char -> Bool
-isMemberString "" c = False
-isMemberString s c = s.[0] == c || isMemberString (s % (1,size s - 1)) c
-
-// From the slides
-skip_nl :: String -> String
-skip_nl str = if (size str > 0 && str.[size str-1] == '\n') (str%(0,size str-2)) str
-
-// From a String and a List of guesses (Chars), return a String that shows dots for letters that were not guessed yet
-stripUnknown :: String [Char] -> String
-stripUnknown s g = toString [if (isMember c g) c '.' \\ c <- (fromString s)]
-
-// Get a random word from the lexicon file
-randomWord :: *env -> (Maybe String, *env) | FileSystem env
-randomWord env
-# (ss,env) = readLines lexicon_file env
-| ss == Nothing = (Nothing, env)
-# (seed,env) = getNewRandomSeed env
-| otherwise = (Just (skip_nl ((shuffle (fromJust ss) seed)!!0)), env)
-
-// word, guesses, mistakes left, stdio -> (win, new guesses, stdio)
-play :: String [Char] Int *File *env -> (Bool, [Char], *File, *env) | FileSystem env
-play w g n io world
-# io = io <<< stripUnknown w g <<< '\n'
-| stripUnknown w g == w = (True, g, io, world)
-# (round,world) = readFile ("round-" +++ (toString n) +++ ".txt") world
-| round == Nothing = abort "Couldn't get gallow"
-# io = io <<< (fromJust round)
-# io = io <<< "Guess (" <<< toString n <<< "): "
-# (ok,g`,io) = freadc io
-# (_,io) = freadline io // to read until the next \n
-| not ok = abort "Couldn't get guessed letter"
-| isMemberString w g` = play w [g`:g] n io world
-| n == 0 = (False, [g`:g], io, world)
-| otherwise = play w [g`:g] (n-1) io world
-
-Start :: *World -> *World
-Start world
-# (word,world) = randomWord world
-| word == Nothing = abort "Couldn't get random word"
-# word = fromJust word
-# (io,world) = stdio world
-# (win,g,io,world) = play word [] 5 io world
-# (lost,world) = readFile "round-lost.txt" world
-| lost == Nothing = abort "Couldn't get gallow"
-# io = if win (io <<< "You win!\n") (io <<< "You lose!\n" <<< fromJust lost)
-# (ok,world) = fclose io world
-| not ok = abort "Couldn't close stdio"
-| otherwise = world
diff --git a/fp2/week1/camil/Random.dcl b/fp2/week1/camil/Random.dcl
deleted file mode 100644
index 47a7c18..0000000
--- a/fp2/week1/camil/Random.dcl
+++ /dev/null
@@ -1,19 +0,0 @@
-definition module Random
-
- // Random number generator voor Linux gebruikers
- // interface compatible met Random.dcl (helaas)
- // -- mschool@science.ru.nl
-
-import StdFile
-
-:: RandomSeed
-
-// nullRandomSeed generates a fixed RandomSeed
-nullRandomSeed :: RandomSeed
-
-// GetNewRandomSeed generates a good RandomSeed, using /dev/urandom
-getNewRandomSeed :: !*env -> (!RandomSeed, !*env) | FileSystem env
-
-// Given a RandomSeed, Random generates a random number and a new RandomSeed.
-random :: !RandomSeed -> .(!Int, !RandomSeed)
-
diff --git a/fp2/week1/camil/Random.icl b/fp2/week1/camil/Random.icl
deleted file mode 100644
index b6e0768..0000000
--- a/fp2/week1/camil/Random.icl
+++ /dev/null
@@ -1,20 +0,0 @@
-implementation module Random
-
-import StdFile, StdList, StdMisc, StdArray, Random
-
-:: RandomSeed :== Int
-
-nullRandomSeed :: RandomSeed
-nullRandomSeed = 0
-
-getNewRandomSeed :: !*env -> (!RandomSeed, !*env) | FileSystem env
-getNewRandomSeed env
-# (ok, src, env) = sfopen "/dev/urandom" FReadData env
-| not ok => abort "could not open /dev/urandom"
-# (bytes, src) = sfreads src 4
- seed = foldl (\x y->(x<<8)+toInt y) 0 [c \\ c<-:bytes]
-| otherwise => (seed, env)
-
-random :: !RandomSeed -> .(!Int, !RandomSeed)
-random seed = (seed>>16 bitand 0xFFFF, seed*0x08088405+1)
-
diff --git a/fp2/week1/camil/SimpleFileIO.dcl b/fp2/week1/camil/SimpleFileIO.dcl
deleted file mode 100644
index 1bd97da..0000000
--- a/fp2/week1/camil/SimpleFileIO.dcl
+++ /dev/null
@@ -1,14 +0,0 @@
-definition module SimpleFileIO
-
-import StdFile, StdOverloaded, StdMaybe
-
-// 1.
-readFile :: String *env -> (Maybe String, *env) | FileSystem env
-writeFile :: String String *env -> (Bool, *env) | FileSystem env
-
-// 2.
-readLines :: String *env -> (Maybe [String],*env) | FileSystem env
-writeLines :: String [String] *env -> (Bool, *env) | FileSystem env
-
-// 3.
-//mapFile :: String String (a -> b) *env -> (Bool, *env) | FileSystem env & ... a & ... b
diff --git a/fp2/week1/camil/SimpleFileIO.icl b/fp2/week1/camil/SimpleFileIO.icl
deleted file mode 100644
index b2a483a..0000000
--- a/fp2/week1/camil/SimpleFileIO.icl
+++ /dev/null
@@ -1,39 +0,0 @@
-implementation module SimpleFileIO
-
-import StdEnv, StdFile, StdOverloaded, StdMaybe
-
-// 1.
-readFile :: String *env -> (Maybe String, *env) | FileSystem env
-readFile s env
-# (ss, env) = readLines s env
-| ss == Nothing = (Nothing, env)
-| otherwise = (Just (foldl (+++) "" (fromJust ss)), env)
-
-writeFile :: String String *env -> (Bool, *env) | FileSystem env
-writeFile fn s env
-# (ok, outfile, env) = fopen fn FWriteText env
-| not ok = (False, env)
-# outfile = fwrites s outfile
-# (ok, env) = fclose outfile env
-| otherwise = (ok, env)
-
-// 2.
-readLines :: String *env -> (Maybe [String],*env) | FileSystem env
-readLines s env
-# (ok, infile, env) = sfopen s FReadText env
-| not ok = (Nothing, env)
-| otherwise = (Just (fst (readLines` infile)), env)
-where
- readLines` :: File -> ([String], File)
- readLines` file
- | sfend file = ([], file)
- # (line, file) = sfreadline file
- # (ss, file) = readLines` file
- | otherwise = ([line : ss], file)
-
-writeLines :: String [String] *env -> (Bool, *env) | FileSystem env
-writeLines fn ss env = writeFile fn (foldl (+++) "" [s +++ "\n" \\ s <- ss]) env
-
-// 3.
-//mapFile :: String String (a -> b) *env -> (Bool, *env) | FileSystem env & ... a & ... b
-
diff --git a/fp2/week1/camil/StdMaybe.dcl b/fp2/week1/camil/StdMaybe.dcl
deleted file mode 100644
index 2403683..0000000
--- a/fp2/week1/camil/StdMaybe.dcl
+++ /dev/null
@@ -1,41 +0,0 @@
-definition module StdMaybe
-
-// ********************************************************************************
-// Clean StdLib library module, version 1.0
-// ********************************************************************************
-
-from StdFunc import :: St;
-from StdOverloaded import class ==(..);
-
-:: Maybe x
- = Just x
- | Nothing
-
-isJust :: !(Maybe .x) -> Bool // case @1 of (Just _) -> True; _ -> False
-isNothing :: !(Maybe .x) -> Bool // not o isJust
-fromJust :: !(Maybe .x) -> .x // \(Just x) -> x
-
-// for possibly unique elements:
-u_isJust :: !u:(Maybe .x) -> (!Bool, !u:Maybe .x)
-u_isNothing :: !u:(Maybe .x) -> (!Bool, !u:Maybe .x)
-
-accMaybe :: .(St .x .a) !u:(Maybe .x) -> (!Maybe .a,!u:Maybe .x)
-// accMaybe f (Just x) = (Just (fst (f x)),Just (snd (f x)))
-// accMaybe f Nothing = (Nothing,Nothing)
-
-mapMaybe :: .(.x -> .y) !(Maybe .x) -> Maybe .y
-// mapMaybe f (Just x) = Just (f x)
-// mapMaybe f Nothing = Nothing
-
-instance == (Maybe x) | == x
-// Nothing==Nothing
-// Just a ==Just b <= a==b
-
-maybeToList :: !(Maybe .a) -> [.a];
-// returns list with no or one element
-
-listToMaybe :: ![.a] -> .Maybe .a;
-// returns Just head of list if possible
-
-catMaybes :: ![Maybe .a] -> .[.a];
-// catMaybes ms = [ m \\ Just m <- ms ]
diff --git a/fp2/week1/camil/StdMaybe.icl b/fp2/week1/camil/StdMaybe.icl
deleted file mode 100644
index 4eed325..0000000
--- a/fp2/week1/camil/StdMaybe.icl
+++ /dev/null
@@ -1,65 +0,0 @@
-implementation module StdMaybe
-
-// ********************************************************************************
-// Clean StdLib library module, version 1.0
-// ********************************************************************************
-
-from StdFunc import :: St;
-from StdOverloaded import class ==(..);
-
-:: Maybe x
- = Just x
- | Nothing
-
-isJust :: !(Maybe .x) -> Bool
-isJust Nothing = False
-isJust _ = True
-
-isNothing :: !(Maybe .x) -> Bool
-isNothing Nothing = True
-isNothing _ = False
-
-u_isJust :: !u:(Maybe .x) -> (!Bool, !u:Maybe .x)
-u_isJust nothing=:Nothing
- = (False, nothing)
-u_isJust just
- = (True, just)
-
-u_isNothing :: !u:(Maybe .x) -> (!Bool, !u:Maybe .x)
-u_isNothing nothing=:Nothing
- = (True, nothing)
-u_isNothing just
- = (False,just)
-
-fromJust :: !(Maybe .x) -> .x
-fromJust (Just x) = x
-
-accMaybe :: .(St .x .a) !u:(Maybe .x) -> (!Maybe .a,!u:Maybe .x)
-accMaybe f (Just x)
- # (a,x) = f x
- = (Just a,Just x)
-accMaybe _ nothing
- = (Nothing,nothing)
-
-mapMaybe :: .(.x -> .y) !(Maybe .x) -> Maybe .y
-mapMaybe f (Just x) = Just (f x)
-mapMaybe _ nothing = Nothing
-
-instance == (Maybe x) | == x where
- (==) Nothing maybe = case maybe of
- Nothing -> True
- just -> False
- (==) (Just a) maybe = case maybe of
- Just b -> a==b
- nothing -> False
-
-maybeToList :: !(Maybe .a) -> [.a];
-maybeToList Nothing = []
-maybeToList (Just a) = [a]
-
-listToMaybe :: ![.a] -> .Maybe .a;
-listToMaybe [] = Nothing
-listToMaybe [a:_] = Just a
-
-catMaybes :: ![Maybe .a] -> .[.a];
-catMaybes ms = [ m \\ Just m <- ms ]
diff --git a/fp2/week1/camil/lexicon.txt b/fp2/week1/camil/lexicon.txt
deleted file mode 100644
index 9c2ad4e..0000000
--- a/fp2/week1/camil/lexicon.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-armada
-balinese
-bergens
-cyprus
-europeanen
-guldensporenslag
-hollandermop
-jordaans
-lagerhuis
-luiker
-mensenzoon
-opperwezen
-randstad
-samaritaan
-sovjettijd
-thailand
-vietnamese
-zeeuws
diff --git a/fp2/week1/camil/round-0.txt b/fp2/week1/camil/round-0.txt
deleted file mode 100644
index 7236e17..0000000
--- a/fp2/week1/camil/round-0.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ------
- | \ |
- o \|
- /O\ |
- |
- |
-________
diff --git a/fp2/week1/camil/round-1.txt b/fp2/week1/camil/round-1.txt
deleted file mode 100644
index 8694aad..0000000
--- a/fp2/week1/camil/round-1.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ------
- | \ |
- o \|
- |
- |
- |
-________
diff --git a/fp2/week1/camil/round-2.txt b/fp2/week1/camil/round-2.txt
deleted file mode 100644
index d46d77c..0000000
--- a/fp2/week1/camil/round-2.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ------
- | \ |
- \|
- |
- |
- |
-________
diff --git a/fp2/week1/camil/round-3.txt b/fp2/week1/camil/round-3.txt
deleted file mode 100644
index 9bdd2ba..0000000
--- a/fp2/week1/camil/round-3.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ------
- \ |
- \|
- |
- |
- |
-________
diff --git a/fp2/week1/camil/round-4.txt b/fp2/week1/camil/round-4.txt
deleted file mode 100644
index 41ca216..0000000
--- a/fp2/week1/camil/round-4.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
- |
- |
- |
- |
- |
-________
diff --git a/fp2/week1/camil/round-5.txt b/fp2/week1/camil/round-5.txt
deleted file mode 100644
index f29c0dd..0000000
--- a/fp2/week1/camil/round-5.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-________
diff --git a/fp2/week1/camil/round-lost.txt b/fp2/week1/camil/round-lost.txt
deleted file mode 100644
index 7ec2fa7..0000000
--- a/fp2/week1/camil/round-lost.txt
+++ /dev/null
@@ -1,7 +0,0 @@
- ------
- | \ |
- o \|
- /O\ |
- / \ |
- |
-________
diff --git a/fp2/week1/camil/week1.tar.gz b/fp2/week1/camil/week1.tar.gz
deleted file mode 100644
index 3533265..0000000
--- a/fp2/week1/camil/week1.tar.gz
+++ /dev/null
Binary files differ
diff --git a/fp2/week1/mart/Echo b/fp2/week1/mart/Echo
deleted file mode 100755
index cf2fb79..0000000
--- a/fp2/week1/mart/Echo
+++ /dev/null
Binary files differ
diff --git a/fp2/week1/mart/Echo.icl b/fp2/week1/mart/Echo.icl
deleted file mode 100644
index 30a6f4b..0000000
--- a/fp2/week1/mart/Echo.icl
+++ /dev/null
@@ -1,11 +0,0 @@
-module Echo
-
-import StdEnv
-
-
-Start :: *World -> *World
-Start world
-# (console, world) = stdio world
-# (line, console) = freadline console
-| not (fend console) = fwrites line
-| otherwise = world
diff --git a/fp2/week1/mart/Galgje b/fp2/week1/mart/Galgje
deleted file mode 100755
index d46de77..0000000
--- a/fp2/week1/mart/Galgje
+++ /dev/null
Binary files differ
diff --git a/fp2/week1/mart/Galgje.icl b/fp2/week1/mart/Galgje.icl
deleted file mode 100644
index e5106ee..0000000
--- a/fp2/week1/mart/Galgje.icl
+++ /dev/null
@@ -1,13 +0,0 @@
-module Galgje
-
-import StdEnv, Random
-
-//randomWord :: *env -> (Maybe String, *env) | FileSystem env
-//randomWord env
-//# (ss,env) = readLines lexicon_file env
-//| ss == Nothing = (Nothing, env)
-//# (seed,env) = getNewRandomSeed env
-//| otherwise = (Just (skip_nl ((shuffle (fromJust ss) seed)!!0)), env)
-
-Start :: *World -> *World
-Start world = world
diff --git a/fp2/week1/mart/GalgjeWF.dcl b/fp2/week1/mart/GalgjeWF.dcl
deleted file mode 100644
index a777b95..0000000
--- a/fp2/week1/mart/GalgjeWF.dcl
+++ /dev/null
@@ -1,5 +0,0 @@
-definition module GalgjeWF
-
-import iTasks
-
-galgje :: [Workflow]
diff --git a/fp2/week1/mart/Random.dcl b/fp2/week1/mart/Random.dcl
deleted file mode 100644
index 47a7c18..0000000
--- a/fp2/week1/mart/Random.dcl
+++ /dev/null
@@ -1,19 +0,0 @@
-definition module Random
-
- // Random number generator voor Linux gebruikers
- // interface compatible met Random.dcl (helaas)
- // -- mschool@science.ru.nl
-
-import StdFile
-
-:: RandomSeed
-
-// nullRandomSeed generates a fixed RandomSeed
-nullRandomSeed :: RandomSeed
-
-// GetNewRandomSeed generates a good RandomSeed, using /dev/urandom
-getNewRandomSeed :: !*env -> (!RandomSeed, !*env) | FileSystem env
-
-// Given a RandomSeed, Random generates a random number and a new RandomSeed.
-random :: !RandomSeed -> .(!Int, !RandomSeed)
-
diff --git a/fp2/week1/mart/Random.icl b/fp2/week1/mart/Random.icl
deleted file mode 100644
index b6e0768..0000000
--- a/fp2/week1/mart/Random.icl
+++ /dev/null
@@ -1,20 +0,0 @@
-implementation module Random
-
-import StdFile, StdList, StdMisc, StdArray, Random
-
-:: RandomSeed :== Int
-
-nullRandomSeed :: RandomSeed
-nullRandomSeed = 0
-
-getNewRandomSeed :: !*env -> (!RandomSeed, !*env) | FileSystem env
-getNewRandomSeed env
-# (ok, src, env) = sfopen "/dev/urandom" FReadData env
-| not ok => abort "could not open /dev/urandom"
-# (bytes, src) = sfreads src 4
- seed = foldl (\x y->(x<<8)+toInt y) 0 [c \\ c<-:bytes]
-| otherwise => (seed, env)
-
-random :: !RandomSeed -> .(!Int, !RandomSeed)
-random seed = (seed>>16 bitand 0xFFFF, seed*0x08088405+1)
-
diff --git a/fp2/week1/mart/RandomGetallen b/fp2/week1/mart/RandomGetallen
deleted file mode 100755
index 0482437..0000000
--- a/fp2/week1/mart/RandomGetallen
+++ /dev/null
Binary files differ
diff --git a/fp2/week1/mart/RandomGetallen.dcl b/fp2/week1/mart/RandomGetallen.dcl
deleted file mode 100644
index 66a2c6c..0000000
--- a/fp2/week1/mart/RandomGetallen.dcl
+++ /dev/null
@@ -1,7 +0,0 @@
-definition module RandomGetallen
-
-import Random
-
-random_n :: Int RandomSeed -> ([Int],RandomSeed)
-random_inf :: RandomSeed -> [Int]
-//shuffle :: [a] RandomSeed -> [a]
diff --git a/fp2/week1/mart/RandomGetallen.icl b/fp2/week1/mart/RandomGetallen.icl
deleted file mode 100644
index b756c91..0000000
--- a/fp2/week1/mart/RandomGetallen.icl
+++ /dev/null
@@ -1,33 +0,0 @@
-implementation module RandomGetallen
-
-import StdEnv, Random
-
-//Start :: *World -> ([Int],*World)
-//Start world
-//# (rs,world) = getNewRandomSeed world
-//= (shuffle [1..10] rs,world)
-
-
-Start = shuffle [1..10] nullRandomSeed
-
-random_n :: Int RandomSeed -> ([Int],RandomSeed)
-random_n n seed = seqList (repeatn n random) seed
-
-random_inf :: RandomSeed -> [Int]
-random_inf seed = iterateSt random seed
-
-iterateSt :: (s -> (a,s)) s -> [a]
-iterateSt f s = [a : iterateSt f s`]
-where
- (a,s`) = f s
-
-shuffle :: [a] RandomSeed -> [a]
-shuffle xs seed = (perms xs) !! ((fst (random seed)) rem (fac (length xs)))
-
-fac :: Int -> Int
-fac 0 = 1
-fac n = n * fac (n-1)
-
-perms :: [a] -> [[a]]
-perms [] = [[]]
-perms xs = [[xs!!i : xs`] \\ i <- [0..length xs - 1] , xs` <- perms (take i xs ++ drop (i+1) xs)]
diff --git a/fp2/week1/mart/SimpleFileIO.dcl b/fp2/week1/mart/SimpleFileIO.dcl
deleted file mode 100644
index 1bd97da..0000000
--- a/fp2/week1/mart/SimpleFileIO.dcl
+++ /dev/null
@@ -1,14 +0,0 @@
-definition module SimpleFileIO
-
-import StdFile, StdOverloaded, StdMaybe
-
-// 1.
-readFile :: String *env -> (Maybe String, *env) | FileSystem env
-writeFile :: String String *env -> (Bool, *env) | FileSystem env
-
-// 2.
-readLines :: String *env -> (Maybe [String],*env) | FileSystem env
-writeLines :: String [String] *env -> (Bool, *env) | FileSystem env
-
-// 3.
-//mapFile :: String String (a -> b) *env -> (Bool, *env) | FileSystem env & ... a & ... b
diff --git a/fp2/week1/mart/SimpleFileIO.icl b/fp2/week1/mart/SimpleFileIO.icl
deleted file mode 100644
index b2a483a..0000000
--- a/fp2/week1/mart/SimpleFileIO.icl
+++ /dev/null
@@ -1,39 +0,0 @@
-implementation module SimpleFileIO
-
-import StdEnv, StdFile, StdOverloaded, StdMaybe
-
-// 1.
-readFile :: String *env -> (Maybe String, *env) | FileSystem env
-readFile s env
-# (ss, env) = readLines s env
-| ss == Nothing = (Nothing, env)
-| otherwise = (Just (foldl (+++) "" (fromJust ss)), env)
-
-writeFile :: String String *env -> (Bool, *env) | FileSystem env
-writeFile fn s env
-# (ok, outfile, env) = fopen fn FWriteText env
-| not ok = (False, env)
-# outfile = fwrites s outfile
-# (ok, env) = fclose outfile env
-| otherwise = (ok, env)
-
-// 2.
-readLines :: String *env -> (Maybe [String],*env) | FileSystem env
-readLines s env
-# (ok, infile, env) = sfopen s FReadText env
-| not ok = (Nothing, env)
-| otherwise = (Just (fst (readLines` infile)), env)
-where
- readLines` :: File -> ([String], File)
- readLines` file
- | sfend file = ([], file)
- # (line, file) = sfreadline file
- # (ss, file) = readLines` file
- | otherwise = ([line : ss], file)
-
-writeLines :: String [String] *env -> (Bool, *env) | FileSystem env
-writeLines fn ss env = writeFile fn (foldl (+++) "" [s +++ "\n" \\ s <- ss]) env
-
-// 3.
-//mapFile :: String String (a -> b) *env -> (Bool, *env) | FileSystem env & ... a & ... b
-