1*46439007SCharles.ForsythTables: module { 2*46439007SCharles.Forsyth PATH: con "/dis/lib/tables.dis"; 3*46439007SCharles.Forsyth Table: adt[T] { 4*46439007SCharles.Forsyth items: array of list of (int, T); 5*46439007SCharles.Forsyth nilval: T; 6*46439007SCharles.Forsyth 7*46439007SCharles.Forsyth new: fn(nslots: int, nilval: T): ref Table[T]; 8*46439007SCharles.Forsyth add: fn(t: self ref Table, id: int, x: T): int; 9*46439007SCharles.Forsyth del: fn(t: self ref Table, id: int): int; 10*46439007SCharles.Forsyth find: fn(t: self ref Table, id: int): T; 11*46439007SCharles.Forsyth }; 12*46439007SCharles.Forsyth 13*46439007SCharles.Forsyth Strhash: adt[T] { 14*46439007SCharles.Forsyth items: array of list of (string, T); 15*46439007SCharles.Forsyth nilval: T; 16*46439007SCharles.Forsyth 17*46439007SCharles.Forsyth new: fn(nslots: int, nilval: T): ref Strhash[T]; 18*46439007SCharles.Forsyth add: fn(t: self ref Strhash, id: string, x: T); 19*46439007SCharles.Forsyth del: fn(t: self ref Strhash, id: string); 20*46439007SCharles.Forsyth find: fn(t: self ref Strhash, id: string): T; 21*46439007SCharles.Forsyth }; 22*46439007SCharles.Forsyth 23*46439007SCharles.Forsyth hash: fn(s: string, n: int): int; 24*46439007SCharles.Forsyth}; 25