author | haftmann |
Fri, 25 May 2007 21:08:46 +0200 | |
changeset 23107 | 0c3c55b7c98f |
parent 22798 | e3962371f568 |
child 23250 | 9886802cbbd6 |
permissions | -rw-r--r-- |
21147 | 1 |
structure ROOT = |
2 |
struct |
|
3 |
||
4 |
structure Code_Generator = |
|
5 |
struct |
|
6 |
||
23107 | 7 |
type 'a eq = {eq : 'a -> 'a -> bool}; |
8 |
fun eq (A_:'a eq) = #eq A_; |
|
21147 | 9 |
|
10 |
end; (*struct Code_Generator*) |
|
11 |
||
12 |
structure List = |
|
13 |
struct |
|
14 |
||
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
22015
diff
changeset
|
15 |
fun memberl A_ x (y :: ys) = |
23107 | 16 |
Code_Generator.eq A_ x y orelse memberl A_ x ys |
22188
a63889770d57
adjusted manual to improved treatment of overloaded constants
haftmann
parents:
22015
diff
changeset
|
17 |
| memberl A_ x [] = false; |
21147 | 18 |
|
19 |
end; (*struct List*) |
|
20 |
||
21 |
structure Codegen = |
|
22 |
struct |
|
23 |
||
22798 | 24 |
fun collect_duplicates B_ xs ys (z :: zs) = |
25 |
(if List.memberl B_ z xs |
|
26 |
then (if List.memberl B_ z ys then collect_duplicates B_ xs ys zs |
|
27 |
else collect_duplicates B_ xs (z :: ys) zs) |
|
28 |
else collect_duplicates B_ (z :: xs) (z :: ys) zs) |
|
29 |
| collect_duplicates B_ xs ys [] = xs; |
|
21147 | 30 |
|
31 |
end; (*struct Codegen*) |
|
32 |
||
33 |
end; (*struct ROOT*) |