include "hash.m"; hash := load Hash Hash->PATH; new: fn(size:int):ref HashTable; HashTable: adt{ insert: fn(h:self ref HashTable, key:string, val:HashVal); find: fn(h:self ref HashTable, key:string):ref HashVal; delete: fn(h:self ref HashTable, key:string); all: fn(h:self ref HashTable): list of HashNode; }; HashVal: adt{ i: int; r: real; s: string; }; HashNode: adt{ key: string; val: ref HashVal; }; fun1, fun2: fn(s:string, n:int):int;
Fun1 and fun2 provide access to two different string hashing functions. Fun1 is the function used internally; fun2 is the same as that used in the Limbo compiler. They each compute the hash value of s and return a value between 0 and n-1.
HASH(2 ) | Rev: Tue Mar 31 02:42:39 GMT 2015 |