blob: 936dcb3b2f7cb9f52dde1ebc2e5a15d01006d771 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
StringIntTab: module
{
PATH: con "/dis/lib/strinttab.dis";
StringInt: adt{
key: string;
val: int;
};
# Binary search of t (which must be sorted) for key.
# Returns (found, val).
lookup: fn(t: array of StringInt, key: string) : (int, int);
# Linear search of t for first pair with given val.
# Returns key (nil if no match).
revlookup: fn(t: array of StringInt, val: int) : string;
};
|