18
|
1 module Exercise_8 where |
|
2 import Form |
|
3 import Data.Ratio |
|
4 import Test.QuickCheck |
|
5 |
|
6 {---------------------------------------------------------------------} |
|
7 {- Aufgabe G8.1 -} |
|
8 |
|
9 f0 :: Fraction |
|
10 f0 = Over 1 2 |
|
11 |
|
12 f1 :: Fraction |
|
13 f1 = Over 7 5 |
|
14 |
|
15 norm :: Fraction -> Fraction |
|
16 norm = undefined |
|
17 |
|
18 |
|
19 |
|
20 {---------------------------------------------------------------------} |
|
21 {- Aufgabe G8.2 -} |
|
22 -- siehe Exercise_8_Form.hs |
|
23 |
|
24 p0 :: Form |
|
25 p0 = (Var "a" :&: Var "b") :|: (Not (Var "a") :&: Not (Var "b")) |
|
26 |
|
27 |
|
28 p1 :: Form |
|
29 p1 = ((Not $ Not $ Var "a") :|: (Not ((Var "b") :->: (Not (Var "c"))))) |
|
30 |
|
31 |
|
32 |
|
33 {---------------------------------------------------------------------} |
|
34 {- Aufgabe G8.3 -} |
|
35 |
|
36 v0 = [("pizza", 7), ("cola", 2), ("apfel", 1)] |
|
37 |
|
38 a0 :: Arith |
|
39 a0 = Add (Add (Mul (Const 3) (IVar "pizza")) (IVar "cola")) (IVar "apfel") |
|
40 |
|
41 data Arith = Add Arith Arith | Mul Arith Arith | Const Integer | IVar String deriving Show |
|
42 |
|
43 |
|
44 evalArith :: [(String,Integer)] -> Arith -> Integer |
|
45 evalArith = undefined |
|
46 |
|
47 |
|
48 |
|
49 {---------------------------------------------------------------------} |
|
50 {- Aufgabe G8.4 -} |
|
51 |
|
52 mkTable :: Form -> [[String]] |
|
53 mkTable = undefined |
|
54 |
|
55 |
|
56 showTable :: Form -> String |
|
57 showTable = unlines . map unwords . mkTable |
|
58 |
|
59 |
|
60 printTable :: Form -> IO () |
|
61 printTable = putStrLn . showTable |