From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id QAA00247; Thu, 12 Aug 2004 16:48:41 +0200 (MET DST) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA32713 for ; Thu, 12 Aug 2004 16:48:40 +0200 (MET DST) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i7CEmeRM007498 for ; Thu, 12 Aug 2004 16:48:40 +0200 Received: from ibm3.cicrp.jussieu.fr (ibm3.cicrp.jussieu.fr [134.157.15.3]) by shiva.jussieu.fr (8.12.11/jtpda-5.4) with ESMTP id i7CEmF95032414 for ; Thu, 12 Aug 2004 16:48:15 +0200 (CEST) X-Ids: 164 Received: from ibm1.cicrp.jussieu.fr (ibm1.cicrp.jussieu.fr [134.157.15.1]) by ibm3.cicrp.jussieu.fr (8.8.8/jtpda/mob-V8) with ESMTP id QAA43232 for ; Thu, 12 Aug 2004 16:46:36 +0200 Received: from localhost (fernande@localhost) by ibm1.cicrp.jussieu.fr (8.8.8/jtpda/mob-v8) with ESMTP id QAA520270 for ; Thu, 12 Aug 2004 16:46:14 +0200 X-Authentication-Warning: ibm1.cicrp.jussieu.fr: fernande owned process doing -bs Date: Thu, 12 Aug 2004 16:46:13 +0200 (DST) From: Diego Olivier Fernandez Pons X-X-Sender: fernande@ibm1 To: caml-list@inria.fr Subject: [Caml-list] Managing a polymorphic environment Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 411B8348.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at shiva.jussieu.fr with ID 411B832F.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Antivirus: scanned by sophie at shiva.jussieu.fr X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pons:01 pons:01 etu:99 pretty-print:01 100.0:01 hashing:01 fernandez:01 fernandez:01 int:01 polymorphic:01 olivier:02 olivier:02 associates:97 float:02 unit:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Bonjour, Here is an other type related problem : I would like to have an environment that associates strings to values let x = ... Env.add x "the number of elements in the knapsack" let c = ... Env.add c "the total cost of the knapsack" The idea is of course to be able to pretty-print the result # Env.print_int x;; the number of elements in the knapsack is 10 - : unit = () # Env.print_float c the total cost of the knapsack is 100.0 - : unit = () Env data structure can be based on equallity only since the user is supposed to add comments only for the most important variables. The simplest idea is once more hashing all variables. But one would like to avoid collisions. Any suggestion ? Diego Olivier ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners