diff options
| author | Camil Staps | 2016-02-02 19:24:50 +0100 | 
|---|---|---|
| committer | Camil Staps | 2016-02-02 19:24:50 +0100 | 
| commit | a7d7542dc646a5fd124ef71e71ce260889f1701b (patch) | |
| tree | 04ed89503bbb3cc9933273a1326a53ca724c3492 /fp1/week1 | |
| parent | week6 camil: working positioning of lines by putting empties at left and righ... (diff) | |
Diffstat (limited to 'fp1/week1')
| -rw-r--r-- | fp1/week1/camil/1.1/Start.icl | 18 | ||||
| -rw-r--r-- | fp1/week1/camil/1.1/antwoorden.txt | 29 | ||||
| -rw-r--r-- | fp1/week1/camil/2.1/NotatieFuncties.icl | 39 | ||||
| -rw-r--r-- | fp1/week1/camil/2.1/antwoorden.txt | 8 | ||||
| -rw-r--r-- | fp1/week1/camil/2.11/BottlesOfBeer.icl | 21 | ||||
| -rw-r--r-- | fp1/week1/camil/2.2/VindtDeRedex.icl | 17 | ||||
| -rw-r--r-- | fp1/week1/camil/2.2/antwoorden.txt | 42 | ||||
| -rw-r--r-- | fp1/week1/camil/2.3/MatchStrings.dcl | 8 | ||||
| -rw-r--r-- | fp1/week1/camil/2.3/MatchStrings.icl | 48 | ||||
| -rw-r--r-- | fp1/week1/mart/1.txt | 3 | ||||
| -rw-r--r-- | fp1/week1/mart/MatchStrings.dcl | 8 | ||||
| -rw-r--r-- | fp1/week1/mart/MatchStrings.icl | 54 | 
12 files changed, 0 insertions, 295 deletions
| diff --git a/fp1/week1/camil/1.1/Start.icl b/fp1/week1/camil/1.1/Start.icl deleted file mode 100644 index b56a850..0000000 --- a/fp1/week1/camil/1.1/Start.icl +++ /dev/null @@ -1,18 +0,0 @@ -module Start
 -
 -import StdEnv
 -
 -Start = expr11
 -
 -expr0 = "Hello World!"
 -expr1 = "Hello " +++ "World!"
 -expr2 = 5
 -expr3 = 5.5
 -//expr4 = 5 + 5.5
 -expr5 = [1..10]
 -expr6 = (expr1,expr2,expr3,expr5)
 -//expr7 = [expr1,expr2,expr3,expr5]
 -expr8 = [1,3..10]
 -expr9 = ['a'..'z']
 -expr10 = ['a','c'..'z']
 -expr11 = ['Hello World!']
\ No newline at end of file diff --git a/fp1/week1/camil/1.1/antwoorden.txt b/fp1/week1/camil/1.1/antwoorden.txt deleted file mode 100644 index 3a223e2..0000000 --- a/fp1/week1/camil/1.1/antwoorden.txt +++ /dev/null @@ -1,29 +0,0 @@ -Antwoorden opgave 1.1 -Camil Staps (s4498062) - -1.	Het programma wordt gecompileerd. -2.	Het programma wordt uitgevoerd. -3.	De data types van de variabelen worden automatisch achterhaald door de IDE (en hoeven dus niet expliciet te  worden gegeven door de programmeur) - -expr1	"Hello World!" -	De strings worden geconcateneerd -expr2	5 -	Dit is een Int waarde -expr3	5.5 -	Dit is een Real waarde -expr4	Type error; cannot unify types Real and Int -	Dat is omdat + is niet gedefinieerd voor Real met Int -expr5	[1,2,3,4,5,6,7,8,9,10] -	Dit is een korte schrijfwijze voor deze lijst ([min..max]) -expr6	("Hello World!",5,5.5,[1,2,3,4,5,6,7,8,9,10]) -	Een tupeltje -expr7	Type error; cannot unify types [Int] and Real -	Dat is omdat elementen van een lijst hetzelfde type moeten hebben, en dat hier niet het geval is -expr8	[1,3,5,7,9] -	Een andere vorm van expr5 waarmee in het begin wordt aangegeven wat de interval is -expr9	['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'] -	Een lijst van karakters -expr10	['a','c','e','g','i','k','m','o','q','s','u','w','y'] -	Een combinatie van expr9 en expr8 -expr11	['H','e','l','l','o',' ','W','o','r','l','d','!'] -	Blijkbaar wordt ['...'] als lijst van karakters beschouwd diff --git a/fp1/week1/camil/2.1/NotatieFuncties.icl b/fp1/week1/camil/2.1/NotatieFuncties.icl deleted file mode 100644 index bab2054..0000000 --- a/fp1/week1/camil/2.1/NotatieFuncties.icl +++ /dev/null @@ -1,39 +0,0 @@ -module NotatieFuncties
 -
 -import StdEnv
 -
 -f1			:: Int
 -f1			= 1 + 5
 -
 -f2			:: Int
 -f2			= (+) 1 5
 -
 -f3			:: Int Int -> Int
 -f3 m n
 -| m < n		= m
 -| otherwise	= n
 -
 -f4			:: String Int -> String
 -f4 s n
 -| n <= 0	= ""
 -| otherwise	= s +++ f4 s (n-1)
 -
 -f5			:: Int Int -> Int
 -f5 x 0		= x
 -f5 x y		= f5 y (x rem y)
 -
 -f6			:: (Int,Int) -> Int
 -f6 x		= fst x + snd x
 -
 -f7			:: (a,b) -> (b,a)
 -f7 (a,b)	= (b,a)
 -
 -f8			:: (a,a) -> (a,a)
 -f8 x		= f7 (f7 x)
 -
 -//Start		= (f3 1 5, f3 4 3, f3 6 6)
 -//Start		= f4 "ab" 4
 -//Start		= (f5 13 5, f5 8 4, f5 20 20)
 -//Start		= f6 (2,3)
 -//Start		= f7 (5,7)
 -Start		= f8 (5,7)
 diff --git a/fp1/week1/camil/2.1/antwoorden.txt b/fp1/week1/camil/2.1/antwoorden.txt deleted file mode 100644 index c0c98d6..0000000 --- a/fp1/week1/camil/2.1/antwoorden.txt +++ /dev/null @@ -1,8 +0,0 @@ -f1	5+1=6; constant -f2	Reverse polix notation voor f1; zelfde functie dus -f3	Geeft de kleinste van twee integers terug -f4	Herhaalt s n keer -f5	Geeft de ggd van x en y met Euclides' algoritme -f6	Geeft de optelling x+y voor een tupel (x,y) -f7	Flipt de twee elementen van een tupel -f8	Flipt de twee elementen van een tupel twee keer (heeft geen effect) diff --git a/fp1/week1/camil/2.11/BottlesOfBeer.icl b/fp1/week1/camil/2.11/BottlesOfBeer.icl deleted file mode 100644 index 70628a1..0000000 --- a/fp1/week1/camil/2.11/BottlesOfBeer.icl +++ /dev/null @@ -1,21 +0,0 @@ -module BottlesOfBeer
 -
 -import StdEnv
 -
 -Start = [(fst_line x +++ "\n" +++ snd_line x +++ "\n\n") \\ x <- [99,98..0]]
 -
 -fst_line :: Int -> String
 -fst_line n = btl n True +++ wall +++ ", " +++ btl n False +++ " of beer."
 -
 -snd_line :: Int -> String
 -snd_line 0 = "Go to the store and buy some more, " +++ btl 99 False +++ wall +++ "."
 -snd_line n = "Take one down and pass it around, " +++ btl (n-1) False +++ wall +++ "."
 -
 -btl :: Int Bool -> String
 -btl 0 True = "No more bottles"
 -btl 0 False = "no more bottles"
 -btl 1 b = "1 bottle"
 -btl n b = toString n +++ " bottles"
 -
 -wall :: String
 -wall = " of beer on the wall"
\ No newline at end of file diff --git a/fp1/week1/camil/2.2/VindtDeRedex.icl b/fp1/week1/camil/2.2/VindtDeRedex.icl deleted file mode 100644 index c7ec330..0000000 --- a/fp1/week1/camil/2.2/VindtDeRedex.icl +++ /dev/null @@ -1,17 +0,0 @@ -module VindtDeRedex
 -
 -import StdEnv
 -
 -e1 = 42
 -
 -e2 = 1 + 125 * 8 / 10 - 59
 -
 -e3 = not True || True && False
 -
 -e4 =  1 + 2  ==  6 - 3
 -
 -e5 = "1 + 2" == "6 - 3"
 -
 -e6 = "1111 + 2222" == "1111" +++ " + " +++ "2222"
 -
 -Start = e6
 diff --git a/fp1/week1/camil/2.2/antwoorden.txt b/fp1/week1/camil/2.2/antwoorden.txt deleted file mode 100644 index 413465c..0000000 --- a/fp1/week1/camil/2.2/antwoorden.txt +++ /dev/null @@ -1,42 +0,0 @@ -e1 = 42 	Is elementair - -e2 = 1 + 125 * 8 / 10 - 59 -e2 = (1 + ((125 * 8) / 10)) - 59 -            ------- -e2 = (1 + (1000 / 10)) - 59 -           --------- -e2 = (1 + 100) - 59 -      ------- -e2 = 101 - 59 -     -------- -e2 = 42 - -e3 = not True || True && False -e3 = (not True) || (True && False) -      -------- -e3 = False || (True && False) -               ------------- -e3 = False || False -     -------------- -e3 = False - -e4 = 1 + 2 == 6 - 3 -e4 = (1 + 2) == (6 - 3) -      ----- -e4 = 3 == (6 - 3) -           ----- -e4 = 3 == 3 -e4 = True - -e5 = "1 + 2" == "6 - 3" -     ------------------ -e5 = False - -e6 = "1111 + 2222" == "1111" +++ " + " +++ "2222" -e6 = "1111 + 2222" == (("1111" +++ " + ") +++ "2222") -                       ----------------- -e6 = "1111 + 2222" == ("1111 + " +++ "2222") -                       -------------------- -e6 = "1111 + 2222" == "1111 + 2222" -     ------------------------------ -e6 = True diff --git a/fp1/week1/camil/2.3/MatchStrings.dcl b/fp1/week1/camil/2.3/MatchStrings.dcl deleted file mode 100644 index 527447c..0000000 --- a/fp1/week1/camil/2.3/MatchStrings.dcl +++ /dev/null @@ -1,8 +0,0 @@ -definition module MatchStrings
 -
 -head			::        String -> Char
 -tail			::        String -> String
 -is_gelijk		:: String String -> Bool
 -is_deelstring	:: String String -> Bool
 -is_deel			:: String String -> Bool
 -is_match		:: String String -> Bool
 diff --git a/fp1/week1/camil/2.3/MatchStrings.icl b/fp1/week1/camil/2.3/MatchStrings.icl deleted file mode 100644 index 17859ae..0000000 --- a/fp1/week1/camil/2.3/MatchStrings.icl +++ /dev/null @@ -1,48 +0,0 @@ -implementation module MatchStrings
 -
 -import StdEnv
 -
 -head				:: String -> Char
 -head ""				= abort "head uitgevoerd op lege string"
 -head s				= s.[0]
 -
 -tail				:: String -> String
 -tail ""				= abort "tail uitgevoerd op lege string"
 -tail s				= s % (1, size s - 1)
 -
 -is_gelijk			:: String String -> Bool
 -is_gelijk "" ""		= True
 -is_gelijk a ""		= False
 -is_gelijk "" b 		= False
 -is_gelijk a b		= (head a == head b) && (is_gelijk (tail a) (tail b))
 -
 -is_deelstring		:: String String -> Bool
 -is_deelstring "" b	= True
 -is_deelstring a ""	= False
 -is_deelstring a b	= is_gelijk a (b % (0, size a - 1)) || is_deelstring a (tail b)
 -
 -is_deel				:: String String -> Bool
 -is_deel "" b		= True
 -is_deel a ""		= False
 -is_deel a b			= head a == head b && is_deel (tail a) (tail b) || is_deel a (tail b)
 -
 -is_match			:: String String -> Bool
 -is_match "" ""		= True
 -is_match "" b		= False
 -is_match "*" ""		= True
 -is_match a ""		= False
 -is_match a b		= (head a == '.' || head a == head b) && is_match (tail a) (tail b) || head a == '*' && (is_match a (tail b) || is_match (tail a) b)
 -
 -//Start				= (head pink_floyd, tail pink_floyd)
 -//Start				= is_gelijk     "" " "
 -//Start				= is_deelstring "there"          pink_floyd
 -//Start				= is_deelstring "there"          marillion
 -//Start				= is_deel       "there"          marillion
 -//Start				= is_deel       "she and her"    pink_floyd
 -//Start				= is_deel       radiohead        pink_floyd
 -//Start				= is_match      "*.here*.here*." pink_floyd
 -//Start				= is_match      ".here.here."    pink_floyd
 -
 -pink_floyd			= "Is there anybody in there?"
 -marillion			= "Just for the record"
 -radiohead			= "There there"
 diff --git a/fp1/week1/mart/1.txt b/fp1/week1/mart/1.txt deleted file mode 100644 index 7ac4230..0000000 --- a/fp1/week1/mart/1.txt +++ /dev/null @@ -1,3 +0,0 @@ -1.1: -1.2: -Beide niet mogelijk zonder IDE(linux) diff --git a/fp1/week1/mart/MatchStrings.dcl b/fp1/week1/mart/MatchStrings.dcl deleted file mode 100644 index 527447c..0000000 --- a/fp1/week1/mart/MatchStrings.dcl +++ /dev/null @@ -1,8 +0,0 @@ -definition module MatchStrings
 -
 -head			::        String -> Char
 -tail			::        String -> String
 -is_gelijk		:: String String -> Bool
 -is_deelstring	:: String String -> Bool
 -is_deel			:: String String -> Bool
 -is_match		:: String String -> Bool
 diff --git a/fp1/week1/mart/MatchStrings.icl b/fp1/week1/mart/MatchStrings.icl deleted file mode 100644 index f10df45..0000000 --- a/fp1/week1/mart/MatchStrings.icl +++ /dev/null @@ -1,54 +0,0 @@ -implementation module MatchStrings
 -
 -import StdEnv
 -
 -head :: String -> Char
 -head "" = abort "Empty String"
 -head s = s.[0]
 -
 -tail :: String -> String
 -tail "" = abort "Empty String"
 -tail s = s % (1, size s - 1)
 -
 -is_gelijk :: String String -> Bool
 -is_gelijk "" "" = True
 -is_gelijk a b = (size a == size b) && (head a == head b) && is_gelijk (tail a) (tail b)
 -
 -is_deelstring :: String String -> Bool
 -is_deelstring _ "" = False
 -is_deelstring a b = is_begin a b || is_deelstring a (tail b)
 -
 -is_begin :: String String -> Bool
 -is_begin "" _ = True
 -is_begin _ "" = False
 -is_begin a b = head a == head b && is_begin (tail a) (tail b)
 -
 -is_deel :: String String -> Bool
 -is_deel "" _ = True
 -is_deel _ "" = False
 -is_deel a b = head a == head b && is_deel (tail a) (tail b) || is_deel a (tail b)
 -
 -is_match :: String String -> Bool
 -is_match a b = is_begin_match a b || size b > 0 && is_begin_match a (tail b)
 -
 -is_begin_match :: String String -> Bool
 -is_begin_match "" _ = True
 -is_begin_match a "" = head a == '*' && size a == 1
 -is_begin_match a b
 -| head a == '.' || head a == head b = is_begin_match (tail a) (tail b)
 -| head a == '*' = is_begin_match a (tail b) || is_begin_match (tail a) b
 -| otherwise = False
 -
 -//Start= (head pink_floyd, tail pink_floyd)
 -//Start= is_gelijk     "" " "
 -//Start= is_deelstring "there"          pink_floyd
 -//Start= is_deelstring "there"          marillion
 -//Start= is_deel       "there"          marillion
 -//Start= is_deel       "she and her"    pink_floyd
 -//Start= is_deel       radiohead        pink_floyd
 -//Start= is_match      "*.here*.here*." pink_floyd
 -//Start= is_match      ".here.here."    pink_floyd
 -
 -pink_floyd= "Is there anybody in there?"
 -marillion= "Just for the record"
 -radiohead= "There there"
 | 
