31
|
1 module Exercise_12 where |
|
2 |
|
3 |
|
4 {---------------------------------------------------------------------} |
|
5 {- Aufgabe G12.1 -} |
|
6 |
|
7 {- |
|
8 |
|
9 Ausdruck: 1 + (2 * 3) |
|
10 |
|
11 |
|
12 Ausdruck: (1 + 2) * (2 + 3) |
|
13 |
|
14 |
|
15 Ausdruck: fst (1 + 2, 2 + 3) |
|
16 |
|
17 |
|
18 Ausdruck: fst (snd (1, 2 + 3), 4) |
|
19 |
|
20 |
|
21 Ausdruck: (\x. 1 + x) (2 * 3) |
|
22 |
|
23 |
|
24 -} |
|
25 |
|
26 {---------------------------------------------------------------------} |
|
27 {- Aufgabe G12.2 -} |
|
28 |
|
29 inf :: a -> [a] |
|
30 inf x = x : inf x |
|
31 |
|
32 f :: [Int] -> [Int] -> [Int] -> Int |
|
33 f (x:xs) (y:ys) zs | x > y = y |
|
34 f (x1:x2:xs) ys (z:zs) = x1 |
|
35 |
|
36 a = f (inf (1+0)) (inf (1+1)) (inf (1+2)) |
|
37 b = f (inf (1+2)) (inf (1+1)) (inf (1+0)) |
|
38 c = f (inf (1+0)) [] (inf (1+1)) |
|
39 |
|
40 |
|
41 {---------------------------------------------------------------------} |
|
42 {- Aufgabe G12.3 -} |
|
43 |
|
44 fib :: Integer -> Integer |
|
45 fib 0 = 0 |
|
46 fib 1 = 1 |
|
47 fib n = fib (n - 1) + fib (n - 2) |
|
48 |
|
49 |
|
50 fib1 :: [Integer] |
|
51 fib1 = undefined |
|
52 |
|
53 |
|
54 fib2 :: Integer -> Integer -> [Integer] |
|
55 fib2 x y = undefined |
|
56 |
|
57 |
|
58 |
|
59 {---------------------------------------------------------------------} |
|
60 {- Aufgabe G12.4 -} |
|
61 |
|
62 hamming :: [Integer] |
|
63 hamming = undefined |
|
64 |
|
65 |
|
66 |
|
67 {---------------------------------------------------------------------} |
|
68 {- Aufgabe H12.1 -} |
|
69 |
|
70 wordsOf :: [a] -> [[a]] |
|
71 wordsOf = undefined |
|
72 |
|
73 |
|
74 |
|
75 {---------------------------------------------------------------------} |
|
76 {- Aufgabe H12.2 -} |
|
77 |
|
78 sumOfPrefixes :: Num a => [a] -> [a] |
|
79 sumOfPrefixes = undefined |
|
80 |
|
81 |
|
82 |
|
83 {---------------------------------------------------------------------} |
|
84 {- Aufgabe H12.3 -} |
|
85 |
|
86 findByFilter :: (a -> Bool) -> [a] -> Maybe a |
|
87 findByFilter = undefined |
|
88 |
|
89 |
|
90 |
|
91 {---------------------------------------------------------------------} |
|
92 {- Aufgabe H12.4 -} |
|
93 |
|
94 {-WETT-} |
|
95 censoredWordsOf :: Eq a => [a] -> [[a]] -> [[a]] |
|
96 censoredWordsOf = undefined |
|
97 {-TTEW-} |