makefile fix and table with results so far added to ex3
[tt2015.git] / a3 / code / Generics / GenMap.icl
1 implementation module GenMap
2
3 import StdClass, StdArray, StdInt, StdFunc
4 import StdGeneric, _Array
5
6 generic gMap a b :: .a -> .b
7 gMap{|c|} x = x
8 gMap{|PAIR|} fx fy (PAIR x y) = PAIR (fx x) (fy y)
9 gMap{|EITHER|} fl fr (LEFT x) = LEFT (fl x)
10 gMap{|EITHER|} fl fr (RIGHT x) = RIGHT (fr x)
11 gMap{|CONS|} f (CONS x) = CONS (f x)
12 gMap{|FIELD|} f (FIELD x) = FIELD (f x)
13 gMap{|OBJECT|} f (OBJECT x) = OBJECT (f x)
14 gMap{|{}|} f xs = mapArray f xs
15 gMap{|{!}|} f xs = mapArray f xs
16
17 derive gMap [], (,), (,,), (,,,), (,,,,), (,,,,,), (,,,,,,), (,,,,,,,)
18