From 46439007cf417cbd9ac8049bb4122c890097a0fa Mon Sep 17 00:00:00 2001 From: "Charles.Forsyth" Date: Fri, 22 Dec 2006 20:52:35 +0000 Subject: 20060303-partial --- module/tables.m | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 module/tables.m (limited to 'module/tables.m') diff --git a/module/tables.m b/module/tables.m new file mode 100644 index 00000000..62f589a8 --- /dev/null +++ b/module/tables.m @@ -0,0 +1,24 @@ +Tables: module { + PATH: con "/dis/lib/tables.dis"; + Table: adt[T] { + items: array of list of (int, T); + nilval: T; + + new: fn(nslots: int, nilval: T): ref Table[T]; + add: fn(t: self ref Table, id: int, x: T): int; + del: fn(t: self ref Table, id: int): int; + find: fn(t: self ref Table, id: int): T; + }; + + Strhash: adt[T] { + items: array of list of (string, T); + nilval: T; + + new: fn(nslots: int, nilval: T): ref Strhash[T]; + add: fn(t: self ref Strhash, id: string, x: T); + del: fn(t: self ref Strhash, id: string); + find: fn(t: self ref Strhash, id: string): T; + }; + + hash: fn(s: string, n: int): int; +}; -- cgit v1.2.3