(************************************************************ hashSample.ml Created : Wed Feb 27 00:59:12 2002 Last modified: Thu Feb 28 01:23:50 2002 Compile: make # ************************************************************) module HashedString = struct type t = string let equal x y = x = y let hash x = Hashtbl.hash x end module StringHash = Hashtbl.Make(HashedString) open StringHash let _ = let size = 1229 in let hash = StringHash.create size in begin StringHash.add hash "takashi" "masuyama"; StringHash.add hash "aki" "okui"; StringHash.add hash "mame" "wo"; StringHash.add hash "inoue" "yosui"; StringHash.add hash "shiba" "inu"; print_string ((StringHash.find hash "aki")^"\n"); print_string ((StringHash.find hash "mame")^"\n"); print_string ((StringHash.find hash "blue")^"\n"); end