author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Tue, 26 Feb 2013 12:47:03 +0000 | |
changeset 197 | 0eef61c56891 |
parent 195 | f06aa4e1c25b |
child 205 | c7975ab7c52e |
permissions | -rw-r--r-- |
195
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
1 |
package object comp2 { |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
2 |
|
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
3 |
// Recusive function to Abacus translation |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
4 |
|
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
5 |
import lib._ |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
6 |
import abacus._ |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
7 |
import recs._ |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
8 |
|
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
9 |
def arity(f: Rec) = f match { |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
10 |
case Z => 1 |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
11 |
case S => 1 |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
12 |
case Id(n, _) => n |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
13 |
case Cn(n, _, _) => n |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
14 |
case Pr(n, _, _) => n |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
15 |
case Mn(n, _) => n |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
16 |
} |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
17 |
|
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
18 |
} |
f06aa4e1c25b
tuned
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff
changeset
|
19 |