Mercurial > 12ws.info2
annotate exercises/src/Exercise_8.hs @ 19:6688bf4a5836
Rename Form-File to match module name
author | Markus Kaiser <markus.kaiser@in.tum.de> |
---|---|
date | Fri, 07 Dec 2012 01:34:16 +0100 |
parents | a899535b1674 |
children | 6d43207984ec |
rev | line source |
---|---|
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 | |
19
6688bf4a5836
Rename Form-File to match module name
Markus Kaiser <markus.kaiser@in.tum.de>
parents:
18
diff
changeset
|
15 |
18 | 16 norm :: Fraction -> Fraction |
17 norm = undefined | |
18 | |
19 | |
20 | |
21 {---------------------------------------------------------------------} | |
22 {- Aufgabe G8.2 -} | |
23 -- siehe Exercise_8_Form.hs | |
24 | |
25 p0 :: Form | |
26 p0 = (Var "a" :&: Var "b") :|: (Not (Var "a") :&: Not (Var "b")) | |
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 |