Haskell in eigen map
[f432xdd.git] / fp / 1 / practicum1.hs
blobbf56cbcc4c1b03fd637902627fde99a6b6d4c76e
1 type Row = [String]
2 type Table = [Row]
4 --tableColumnLen :: Table -> [Int] -> [Int]
5 testrow :: Row
6 testrowb :: Row
7 testrow = ["Comp", "jf"]
8 testrowb = ["He", "Universiteit Utrecht"]
10 compilers :: Table
11 compilers =
12 [ ["Compiler", "Universiteit/bedrijf"]
13 , ["Helium", "Universiteit Utrecht"]
14 , ["NHC", "University of York"]
15 , ["GHC", "Microsoft Research"]
16 , ["Hugs", "Galois Connections"]
17 , ["Hugs.NET", "Galois Connections"]
18 , ["O'Haskell", "Oregon Graduate Institute"]
19 , ["O'Haskell", "Chalmers University of Technology"]
20 , ["HBC", "Chalmers University of Technology"]
23 locaties :: Table
24 locaties =
25 [ ["Universiteit/bedrijf", "Land", "Stad"]
26 , ["Universiteit Utrecht", "Nederland", "Utrecht"]
27 , ["University of York", "Engeland", "York"]
28 , ["Microsoft Research", "Engeland", "Cambridge"]
29 , ["Galois Connections", "Verenigde Staten", "Beaverton"]
30 , ["Oregon Graduate Institute", "Verenigde Staten", "Beaverton"]
31 , ["Chalmers University of Technology", "Zweden", "Goteborg"]
35 --tableColumnLen [] s = return s -- Return size of header
36 --tableColumnLen (x:xs) = tableRowLen(x) --tableColumnLen(xs)
38 tableRowLen :: Row -> [Int]
39 tableRowLen [] = []
40 tableRowLen (x:xs) = z where z = length(x) : tableRowLen(xs)
42 compareLen :: [Int] -> [Int] -> [Int]
43 compareLen [] [] = []
44 compareLen (x:xs) (y:ys) = max(x)(y) : compareLen(xs)(ys)
46 getMaxTableRowLen :: Table -> Row -> [Int]
47 getMaxTableRowLen [] [] = [];
48 getMaxTableRowLen (x:xs) [] = getMaxTableRowLen(xs)(x)
49 getMaxTableRowLen (x:xs) y = compareLen(tableRowLen(x))(tableRowLen(y))