author | wenzelm |
Fri, 08 Aug 2008 19:28:59 +0200 | |
changeset 27794 | bdea6e17cbe3 |
parent 27783 | cd5ae3dbd30e |
child 28334 | 7c693bb76366 |
permissions | -rw-r--r-- |
6118 | 1 |
(* Title: Pure/General/table.ML |
5015 | 2 |
ID: $Id$ |
15014 | 3 |
Author: Markus Wenzel and Stefan Berghofer, TU Muenchen |
5015 | 4 |
|
16342 | 5 |
Generic tables. Efficient purely functional implementation using |
6 |
balanced 2-3 trees. |
|
5015 | 7 |
*) |
8 |
||
9 |
signature KEY = |
|
10 |
sig |
|
11 |
type key |
|
12 |
val ord: key * key -> order |
|
13 |
end; |
|
14 |
||
15 |
signature TABLE = |
|
16 |
sig |
|
17 |
type key |
|
18 |
type 'a table |
|
19 |
exception DUP of key |
|
19031 | 20 |
exception SAME |
15014 | 21 |
exception UNDEF of key |
5015 | 22 |
val empty: 'a table |
23 |
val is_empty: 'a table -> bool |
|
5681 | 24 |
val map: ('a -> 'b) -> 'a table -> 'b table |
16446 | 25 |
val map': (key -> 'a -> 'b) -> 'a table -> 'b table |
26 |
val fold: (key * 'b -> 'a -> 'a) -> 'b table -> 'a -> 'a |
|
17579 | 27 |
val fold_map: (key * 'b -> 'a -> 'c * 'a) -> 'b table -> 'a -> 'c table * 'a |
5015 | 28 |
val dest: 'a table -> (key * 'a) list |
5681 | 29 |
val keys: 'a table -> key list |
27508 | 30 |
val exists: (key * 'a -> bool) -> 'a table -> bool |
31 |
val forall: (key * 'a -> bool) -> 'a table -> bool |
|
32 |
val get_first: (key * 'a -> 'b option) -> 'a table -> 'b option |
|
8409 | 33 |
val min_key: 'a table -> key option |
15160 | 34 |
val max_key: 'a table -> key option |
16887 | 35 |
val defined: 'a table -> key -> bool |
17412 | 36 |
val lookup: 'a table -> key -> 'a option |
37 |
val update: (key * 'a) -> 'a table -> 'a table |
|
38 |
val update_new: (key * 'a) -> 'a table -> 'a table (*exception DUP*) |
|
17179 | 39 |
val default: key * 'a -> 'a table -> 'a table |
15665 | 40 |
val map_entry: key -> ('a -> 'a) -> 'a table -> 'a table |
20141 | 41 |
val map_default: (key * 'a) -> ('a -> 'a) -> 'a table -> 'a table |
23655
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
42 |
val make: (key * 'a) list -> 'a table (*exception DUP*) |
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
43 |
val extend: 'a table * (key * 'a) list -> 'a table (*exception DUP*) |
19031 | 44 |
val join: (key -> 'a * 'a -> 'a) (*exception DUP/SAME*) -> |
23655
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
45 |
'a table * 'a table -> 'a table (*exception DUP*) |
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
46 |
val merge: ('a * 'a -> bool) -> 'a table * 'a table -> 'a table (*exception DUP*) |
15665 | 47 |
val delete: key -> 'a table -> 'a table (*exception UNDEF*) |
15761 | 48 |
val delete_safe: key -> 'a table -> 'a table |
16466 | 49 |
val member: ('b * 'a -> bool) -> 'a table -> key * 'b -> bool |
15761 | 50 |
val insert: ('a * 'a -> bool) -> key * 'a -> 'a table -> 'a table (*exception DUP*) |
16139 | 51 |
val remove: ('b * 'a -> bool) -> key * 'b -> 'a table -> 'a table |
18946 | 52 |
val lookup_list: 'a list table -> key -> 'a list |
25391 | 53 |
val cons_list: (key * 'a) -> 'a list table -> 'a list table |
19506 | 54 |
val insert_list: ('a * 'a -> bool) -> key * 'a -> 'a list table -> 'a list table |
18946 | 55 |
val remove_list: ('b * 'a -> bool) -> key * 'b -> 'a list table -> 'a list table |
25391 | 56 |
val update_list: ('a * 'a -> bool) -> key * 'a -> 'a list table -> 'a list table |
18946 | 57 |
val make_list: (key * 'a) list -> 'a list table |
58 |
val dest_list: 'a list table -> (key * 'a) list |
|
59 |
val merge_list: ('a * 'a -> bool) -> |
|
23655
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
60 |
'a list table * 'a list table -> 'a list table (*exception DUP*) |
5015 | 61 |
end; |
62 |
||
63 |
functor TableFun(Key: KEY): TABLE = |
|
64 |
struct |
|
65 |
||
66 |
||
67 |
(* datatype table *) |
|
68 |
||
69 |
type key = Key.key; |
|
70 |
||
71 |
datatype 'a table = |
|
72 |
Empty | |
|
73 |
Branch2 of 'a table * (key * 'a) * 'a table | |
|
74 |
Branch3 of 'a table * (key * 'a) * 'a table * (key * 'a) * 'a table; |
|
75 |
||
76 |
exception DUP of key; |
|
77 |
||
78 |
||
5681 | 79 |
(* empty *) |
80 |
||
5015 | 81 |
val empty = Empty; |
82 |
||
83 |
fun is_empty Empty = true |
|
84 |
| is_empty _ = false; |
|
85 |
||
5681 | 86 |
|
87 |
(* map and fold combinators *) |
|
88 |
||
16657 | 89 |
fun map_table f = |
90 |
let |
|
91 |
fun map Empty = Empty |
|
92 |
| map (Branch2 (left, (k, x), right)) = |
|
93 |
Branch2 (map left, (k, f k x), map right) |
|
94 |
| map (Branch3 (left, (k1, x1), mid, (k2, x2), right)) = |
|
95 |
Branch3 (map left, (k1, f k1 x1), map mid, (k2, f k2 x2), map right); |
|
96 |
in map end; |
|
5681 | 97 |
|
16657 | 98 |
fun fold_table f = |
99 |
let |
|
100 |
fun fold Empty x = x |
|
101 |
| fold (Branch2 (left, p, right)) x = |
|
102 |
fold right (f p (fold left x)) |
|
103 |
| fold (Branch3 (left, p1, mid, p2, right)) x = |
|
104 |
fold right (f p2 (fold mid (f p1 (fold left x)))); |
|
105 |
in fold end; |
|
5681 | 106 |
|
17709 | 107 |
fun fold_map_table f = |
17579 | 108 |
let |
109 |
fun fold_map Empty s = (Empty, s) |
|
110 |
| fold_map (Branch2 (left, p as (k, x), right)) s = |
|
111 |
s |
|
112 |
|> fold_map left |
|
113 |
||>> f p |
|
114 |
||>> fold_map right |
|
115 |
|-> (fn ((l, e), r) => pair (Branch2 (l, (k, e), r))) |
|
116 |
| fold_map (Branch3 (left, p1 as (k1, x1), mid, p2 as (k2, x2), right)) s = |
|
117 |
s |
|
118 |
|> fold_map left |
|
119 |
||>> f p1 |
|
120 |
||>> fold_map mid |
|
121 |
||>> f p2 |
|
122 |
||>> fold_map right |
|
123 |
|-> (fn ((((l, e1), m), e2), r) => pair (Branch3 (l, (k1, e1), m, (k2, e2), r))) |
|
124 |
in fold_map end; |
|
125 |
||
16446 | 126 |
fun dest tab = rev (fold_table cons tab []); |
127 |
fun keys tab = rev (fold_table (cons o #1) tab []); |
|
16192 | 128 |
|
27508 | 129 |
fun get_first f tab = |
130 |
let |
|
131 |
exception FOUND of 'b option; |
|
132 |
fun get entry () = (case f entry of NONE => () | some => raise FOUND some); |
|
133 |
in (fold_table get tab (); NONE) handle FOUND res => res end; |
|
16192 | 134 |
|
27508 | 135 |
fun exists pred = |
136 |
is_some o get_first (fn entry => if pred entry then SOME () else NONE); |
|
16192 | 137 |
|
138 |
fun forall pred = not o exists (not o pred); |
|
139 |
||
27508 | 140 |
|
141 |
(* min/max keys *) |
|
5015 | 142 |
|
15531 | 143 |
fun min_key Empty = NONE |
16864 | 144 |
| min_key (Branch2 (Empty, (k, _), _)) = SOME k |
145 |
| min_key (Branch3 (Empty, (k, _), _, _, _)) = SOME k |
|
146 |
| min_key (Branch2 (left, _, _)) = min_key left |
|
147 |
| min_key (Branch3 (left, _, _, _, _)) = min_key left; |
|
8409 | 148 |
|
15531 | 149 |
fun max_key Empty = NONE |
16864 | 150 |
| max_key (Branch2 (_, (k, _), Empty)) = SOME k |
151 |
| max_key (Branch3 (_, _, _, (k, _), Empty)) = SOME k |
|
152 |
| max_key (Branch2 (_, _, right)) = max_key right |
|
153 |
| max_key (Branch3 (_, _, _, _, right)) = max_key right; |
|
15665 | 154 |
|
5015 | 155 |
|
156 |
(* lookup *) |
|
157 |
||
19031 | 158 |
fun lookup tab key = |
159 |
let |
|
160 |
fun look Empty = NONE |
|
161 |
| look (Branch2 (left, (k, x), right)) = |
|
162 |
(case Key.ord (key, k) of |
|
163 |
LESS => look left |
|
164 |
| EQUAL => SOME x |
|
165 |
| GREATER => look right) |
|
166 |
| look (Branch3 (left, (k1, x1), mid, (k2, x2), right)) = |
|
167 |
(case Key.ord (key, k1) of |
|
168 |
LESS => look left |
|
169 |
| EQUAL => SOME x1 |
|
170 |
| GREATER => |
|
171 |
(case Key.ord (key, k2) of |
|
172 |
LESS => look mid |
|
173 |
| EQUAL => SOME x2 |
|
174 |
| GREATER => look right)); |
|
175 |
in look tab end; |
|
5015 | 176 |
|
19031 | 177 |
fun defined tab key = |
178 |
let |
|
179 |
fun def Empty = false |
|
180 |
| def (Branch2 (left, (k, x), right)) = |
|
181 |
(case Key.ord (key, k) of |
|
182 |
LESS => def left |
|
183 |
| EQUAL => true |
|
184 |
| GREATER => def right) |
|
185 |
| def (Branch3 (left, (k1, x1), mid, (k2, x2), right)) = |
|
186 |
(case Key.ord (key, k1) of |
|
187 |
LESS => def left |
|
188 |
| EQUAL => true |
|
189 |
| GREATER => |
|
190 |
(case Key.ord (key, k2) of |
|
191 |
LESS => def mid |
|
192 |
| EQUAL => true |
|
193 |
| GREATER => def right)); |
|
194 |
in def tab end; |
|
16887 | 195 |
|
5015 | 196 |
|
19031 | 197 |
(* modify *) |
5015 | 198 |
|
199 |
datatype 'a growth = |
|
200 |
Stay of 'a table | |
|
201 |
Sprout of 'a table * (key * 'a) * 'a table; |
|
202 |
||
15761 | 203 |
exception SAME; |
204 |
||
15665 | 205 |
fun modify key f tab = |
206 |
let |
|
207 |
fun modfy Empty = Sprout (Empty, (key, f NONE), Empty) |
|
208 |
| modfy (Branch2 (left, p as (k, x), right)) = |
|
209 |
(case Key.ord (key, k) of |
|
210 |
LESS => |
|
211 |
(case modfy left of |
|
212 |
Stay left' => Stay (Branch2 (left', p, right)) |
|
213 |
| Sprout (left1, q, left2) => Stay (Branch3 (left1, q, left2, p, right))) |
|
214 |
| EQUAL => Stay (Branch2 (left, (k, f (SOME x)), right)) |
|
215 |
| GREATER => |
|
216 |
(case modfy right of |
|
217 |
Stay right' => Stay (Branch2 (left, p, right')) |
|
218 |
| Sprout (right1, q, right2) => |
|
219 |
Stay (Branch3 (left, p, right1, q, right2)))) |
|
220 |
| modfy (Branch3 (left, p1 as (k1, x1), mid, p2 as (k2, x2), right)) = |
|
221 |
(case Key.ord (key, k1) of |
|
5015 | 222 |
LESS => |
15665 | 223 |
(case modfy left of |
224 |
Stay left' => Stay (Branch3 (left', p1, mid, p2, right)) |
|
225 |
| Sprout (left1, q, left2) => |
|
226 |
Sprout (Branch2 (left1, q, left2), p1, Branch2 (mid, p2, right))) |
|
227 |
| EQUAL => Stay (Branch3 (left, (k1, f (SOME x1)), mid, p2, right)) |
|
5015 | 228 |
| GREATER => |
15665 | 229 |
(case Key.ord (key, k2) of |
230 |
LESS => |
|
231 |
(case modfy mid of |
|
232 |
Stay mid' => Stay (Branch3 (left, p1, mid', p2, right)) |
|
233 |
| Sprout (mid1, q, mid2) => |
|
234 |
Sprout (Branch2 (left, p1, mid1), q, Branch2 (mid2, p2, right))) |
|
235 |
| EQUAL => Stay (Branch3 (left, p1, mid, (k2, f (SOME x2)), right)) |
|
236 |
| GREATER => |
|
237 |
(case modfy right of |
|
238 |
Stay right' => Stay (Branch3 (left, p1, mid, p2, right')) |
|
239 |
| Sprout (right1, q, right2) => |
|
240 |
Sprout (Branch2 (left, p1, mid), p2, Branch2 (right1, q, right2))))); |
|
5015 | 241 |
|
15665 | 242 |
in |
243 |
(case modfy tab of |
|
244 |
Stay tab' => tab' |
|
245 |
| Sprout br => Branch2 br) |
|
246 |
handle SAME => tab |
|
247 |
end; |
|
5015 | 248 |
|
17412 | 249 |
fun update (key, x) tab = modify key (fn _ => x) tab; |
250 |
fun update_new (key, x) tab = modify key (fn NONE => x | SOME _ => raise DUP key) tab; |
|
17709 | 251 |
fun default (key, x) tab = modify key (fn NONE => x | SOME _ => raise SAME) tab; |
15761 | 252 |
fun map_entry key f = modify key (fn NONE => raise SAME | SOME x => f x); |
27783 | 253 |
fun map_default (key, x) f = modify key (fn NONE => f x | SOME y => f y); |
5015 | 254 |
|
255 |
||
15014 | 256 |
(* delete *) |
257 |
||
15665 | 258 |
exception UNDEF of key; |
259 |
||
260 |
local |
|
261 |
||
262 |
fun compare NONE (k2, _) = LESS |
|
263 |
| compare (SOME k1) (k2, _) = Key.ord (k1, k2); |
|
15014 | 264 |
|
265 |
fun if_eq EQUAL x y = x |
|
266 |
| if_eq _ x y = y; |
|
267 |
||
15531 | 268 |
fun del (SOME k) Empty = raise UNDEF k |
269 |
| del NONE (Branch2 (Empty, p, Empty)) = (p, (true, Empty)) |
|
270 |
| del NONE (Branch3 (Empty, p, Empty, q, Empty)) = |
|
15014 | 271 |
(p, (false, Branch2 (Empty, q, Empty))) |
15665 | 272 |
| del k (Branch2 (Empty, p, Empty)) = (case compare k p of |
16002 | 273 |
EQUAL => (p, (true, Empty)) | _ => raise UNDEF (the k)) |
15665 | 274 |
| del k (Branch3 (Empty, p, Empty, q, Empty)) = (case compare k p of |
15014 | 275 |
EQUAL => (p, (false, Branch2 (Empty, q, Empty))) |
15665 | 276 |
| _ => (case compare k q of |
15014 | 277 |
EQUAL => (q, (false, Branch2 (Empty, p, Empty))) |
16002 | 278 |
| _ => raise UNDEF (the k))) |
15665 | 279 |
| del k (Branch2 (l, p, r)) = (case compare k p of |
15014 | 280 |
LESS => (case del k l of |
281 |
(p', (false, l')) => (p', (false, Branch2 (l', p, r))) |
|
282 |
| (p', (true, l')) => (p', case r of |
|
283 |
Branch2 (rl, rp, rr) => |
|
284 |
(true, Branch3 (l', p, rl, rp, rr)) |
|
285 |
| Branch3 (rl, rp, rm, rq, rr) => (false, Branch2 |
|
286 |
(Branch2 (l', p, rl), rp, Branch2 (rm, rq, rr))))) |
|
15531 | 287 |
| ord => (case del (if_eq ord NONE k) r of |
15014 | 288 |
(p', (false, r')) => (p', (false, Branch2 (l, if_eq ord p' p, r'))) |
289 |
| (p', (true, r')) => (p', case l of |
|
290 |
Branch2 (ll, lp, lr) => |
|
291 |
(true, Branch3 (ll, lp, lr, if_eq ord p' p, r')) |
|
292 |
| Branch3 (ll, lp, lm, lq, lr) => (false, Branch2 |
|
293 |
(Branch2 (ll, lp, lm), lq, Branch2 (lr, if_eq ord p' p, r')))))) |
|
15665 | 294 |
| del k (Branch3 (l, p, m, q, r)) = (case compare k q of |
295 |
LESS => (case compare k p of |
|
15014 | 296 |
LESS => (case del k l of |
297 |
(p', (false, l')) => (p', (false, Branch3 (l', p, m, q, r))) |
|
298 |
| (p', (true, l')) => (p', (false, case (m, r) of |
|
299 |
(Branch2 (ml, mp, mr), Branch2 _) => |
|
300 |
Branch2 (Branch3 (l', p, ml, mp, mr), q, r) |
|
301 |
| (Branch3 (ml, mp, mm, mq, mr), _) => |
|
302 |
Branch3 (Branch2 (l', p, ml), mp, Branch2 (mm, mq, mr), q, r) |
|
303 |
| (Branch2 (ml, mp, mr), Branch3 (rl, rp, rm, rq, rr)) => |
|
304 |
Branch3 (Branch2 (l', p, ml), mp, Branch2 (mr, q, rl), rp, |
|
305 |
Branch2 (rm, rq, rr))))) |
|
15531 | 306 |
| ord => (case del (if_eq ord NONE k) m of |
15014 | 307 |
(p', (false, m')) => |
308 |
(p', (false, Branch3 (l, if_eq ord p' p, m', q, r))) |
|
309 |
| (p', (true, m')) => (p', (false, case (l, r) of |
|
310 |
(Branch2 (ll, lp, lr), Branch2 _) => |
|
311 |
Branch2 (Branch3 (ll, lp, lr, if_eq ord p' p, m'), q, r) |
|
312 |
| (Branch3 (ll, lp, lm, lq, lr), _) => |
|
313 |
Branch3 (Branch2 (ll, lp, lm), lq, |
|
314 |
Branch2 (lr, if_eq ord p' p, m'), q, r) |
|
315 |
| (_, Branch3 (rl, rp, rm, rq, rr)) => |
|
316 |
Branch3 (l, if_eq ord p' p, Branch2 (m', q, rl), rp, |
|
317 |
Branch2 (rm, rq, rr)))))) |
|
15531 | 318 |
| ord => (case del (if_eq ord NONE k) r of |
15014 | 319 |
(q', (false, r')) => |
320 |
(q', (false, Branch3 (l, p, m, if_eq ord q' q, r'))) |
|
321 |
| (q', (true, r')) => (q', (false, case (l, m) of |
|
322 |
(Branch2 _, Branch2 (ml, mp, mr)) => |
|
323 |
Branch2 (l, p, Branch3 (ml, mp, mr, if_eq ord q' q, r')) |
|
324 |
| (_, Branch3 (ml, mp, mm, mq, mr)) => |
|
325 |
Branch3 (l, p, Branch2 (ml, mp, mm), mq, |
|
326 |
Branch2 (mr, if_eq ord q' q, r')) |
|
327 |
| (Branch3 (ll, lp, lm, lq, lr), Branch2 (ml, mp, mr)) => |
|
328 |
Branch3 (Branch2 (ll, lp, lm), lq, Branch2 (lr, p, ml), mp, |
|
329 |
Branch2 (mr, if_eq ord q' q, r')))))); |
|
330 |
||
15665 | 331 |
in |
332 |
||
15761 | 333 |
fun delete key tab = snd (snd (del (SOME key) tab)); |
334 |
fun delete_safe key tab = delete key tab handle UNDEF _ => tab; |
|
15014 | 335 |
|
15665 | 336 |
end; |
337 |
||
15014 | 338 |
|
19031 | 339 |
(* membership operations *) |
16466 | 340 |
|
341 |
fun member eq tab (key, x) = |
|
17412 | 342 |
(case lookup tab key of |
16466 | 343 |
NONE => false |
344 |
| SOME y => eq (x, y)); |
|
15761 | 345 |
|
346 |
fun insert eq (key, x) = |
|
347 |
modify key (fn NONE => x | SOME y => if eq (x, y) then raise SAME else raise DUP key); |
|
348 |
||
349 |
fun remove eq (key, x) tab = |
|
17412 | 350 |
(case lookup tab key of |
15761 | 351 |
NONE => tab |
352 |
| SOME y => if eq (x, y) then delete key tab else tab); |
|
353 |
||
354 |
||
19031 | 355 |
(* simultaneous modifications *) |
356 |
||
23655
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
357 |
fun extend (table, args) = fold update_new args table; |
19031 | 358 |
|
359 |
fun make entries = extend (empty, entries); |
|
5015 | 360 |
|
12287 | 361 |
fun join f (table1, table2) = |
23655
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
362 |
let fun add (key, y) tab = modify key (fn NONE => y | SOME x => f key (x, y)) tab; |
d2d1138e0ddc
replaced exception TableFun/GraphFun.DUPS by TableFun/GraphFun.DUP;
wenzelm
parents:
21065
diff
changeset
|
363 |
in fold_table add table2 table1 end; |
12287 | 364 |
|
19031 | 365 |
fun merge eq = join (fn key => fn xy => if eq xy then raise SAME else raise DUP key); |
5015 | 366 |
|
367 |
||
19031 | 368 |
(* list tables *) |
15761 | 369 |
|
18946 | 370 |
fun lookup_list tab key = these (lookup tab key); |
25391 | 371 |
|
372 |
fun cons_list (key, x) tab = modify key (fn NONE => [x] | SOME xs => x :: xs) tab; |
|
5015 | 373 |
|
20124 | 374 |
fun insert_list eq (key, x) = |
375 |
modify key (fn NONE => [x] | SOME xs => if Library.member eq xs x then raise SAME else x :: xs); |
|
25391 | 376 |
|
18946 | 377 |
fun remove_list eq (key, x) tab = |
15761 | 378 |
map_entry key (fn xs => (case Library.remove eq x xs of [] => raise UNDEF key | ys => ys)) tab |
379 |
handle UNDEF _ => delete key tab; |
|
5015 | 380 |
|
25391 | 381 |
fun update_list eq (key, x) = |
382 |
modify key (fn NONE => [x] | SOME [] => [x] | SOME (xs as y :: _) => |
|
383 |
if eq (x, y) then raise SAME else Library.update eq x xs); |
|
384 |
||
385 |
fun make_list args = fold_rev cons_list args empty; |
|
19482
9f11af8f7ef9
tuned basic list operators (flat, maps, map_filter);
wenzelm
parents:
19073
diff
changeset
|
386 |
fun dest_list tab = maps (fn (key, xs) => map (pair key) xs) (dest tab); |
19031 | 387 |
fun merge_list eq = join (fn _ => Library.merge eq); |
5015 | 388 |
|
389 |
||
5681 | 390 |
(*final declarations of this structure!*) |
16446 | 391 |
fun map f = map_table (K f); |
392 |
val map' = map_table; |
|
393 |
val fold = fold_table; |
|
17579 | 394 |
val fold_map = fold_map_table; |
5015 | 395 |
|
396 |
end; |
|
397 |
||
16342 | 398 |
structure Inttab = TableFun(type key = int val ord = int_ord); |
16687
51fa05ce0f32
Symtab: use fast_string_ord instead of string_ord -- affects order of Symtab.dest etc.;
wenzelm
parents:
16657
diff
changeset
|
399 |
structure Symtab = TableFun(type key = string val ord = fast_string_ord); |