From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA07653 for caml-redistribution; Fri, 26 Feb 1999 20:14:17 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id OAA30029 for ; Fri, 26 Feb 1999 14:03:32 +0100 (MET) Received: from fw.cenatoulouse.dgac.fr (fw.cenatoulouse.dgac.fr [195.83.98.200]) by nez-perce.inria.fr (8.8.7/8.8.7) with SMTP id OAA06153 for ; Fri, 26 Feb 1999 14:03:30 +0100 (MET) Received: by fw.cenatoulouse.dgac.fr; (5.65v3.2/1.3/10May95) id AA30376; Fri, 26 Feb 1999 14:03:30 +0100 Received: from somewhere by smtpxd Sender: weis Message-Id: <36D69BA0.883EDADD@cenatls.cena.dgac.fr> Date: Fri, 26 Feb 1999 14:03:28 +0100 From: RICCI Pierre Organization: CENA of DGAC X-Mailer: Mozilla 4.5 [en] (X11; I; SunOS 5.5.1 sun4u) X-Accept-Language: en Mime-Version: 1.0 To: caml-list@inria.fr Subject: problem with Hashtbl.add function... Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I have a little problem with the function Hashtbl.add. I use it in a form like this: List.iter (fun a:->Hashtbl.add tbl !time a) !b; where (b:aircraft) is a list of structure like type aircraft = { pln : pln; mutable where : point3D; mutable heading : seconds; mutable cfl : level; mutable phase : phase; mutable g_speed : kts; mutable v_speed : feetpmn; mutable sector : string; mutable instruction : (action * int * int) option; err_gspeed : int; (* 100 +/- 5 *) err_vspeed : int (* 100 +/- 20 *) } where pln, point3D... are structures too. The result of the add command might give me a hashing table with a key=time and data=aircrafts with their position for each key. The problem is I obtain a hashing table where key=time but data=aircrafts with always the same position for each one. I think maybe it's the parameter "n" in (Hashtbl.hash_param n m x) which is too small, but I dont know how to change it. If, I want to rewrite the add function in my program, using n parameter with 30 by example, the compilator tells me he doesn't know the data field of h. let add h key info = let i = (hash_param 10 100 key) mod (Array.length h.data) in let bucket = Cons(key, info, h.data.(i)) in h.data.(i) <- bucket; if bucket_too_long h.max_len bucket then resize hash h Can anyone help me ? PS: Please escuse me if the error is too simple but I don't see the mistake. bye. -- ____________________________________________________________ Pierre RICCI | Email : pricci@cenatls.cena.dgac.fr | Tel : (+33) 62 25 95 28 CENA Toulouse | Fax : (+33) 62 25 95 99 ____________________________________________________________ Cellule MSS ( Modelisation Stochastique et Statistiques ) ____________________________________________________________ 7 avenue Edouard Belin BP 4005 (site de l'ENAC) 31055 Toulouse Cedex FRANCE ____________________________________________________________ ************************************************************