From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 71B1CBC0A for ; Wed, 3 Jan 2007 03:29:00 +0100 (CET) Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l032Sx7s010607 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Wed, 3 Jan 2007 03:29:00 +0100 Received: from [80.229.56.224] (helo=[10.0.0.5]) by pih-relay05.plus.net with esmtp (Exim) id 1H1vsB-0006DI-7C for caml-list@yquem.inria.fr; Wed, 03 Jan 2007 02:28:59 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] symbol table containing symbol tables Date: Wed, 3 Jan 2007 02:26:57 +0000 User-Agent: KMail/1.9.5 References: <886949.65043.qm@web82112.mail.mud.yahoo.com> In-Reply-To: <886949.65043.qm@web82112.mail.mud.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200701030226.57444.jon@ffconsultancy.com> X-Miltered: at concorde with ID 459B14EB.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 recursive:01 sig:01 struct:01 sig:01 ocaml:01 frog:98 wrote:01 rec:01 rec:01 caml-list:01 int:01 int:01 modules:02 caml:02 On Wednesday 03 January 2007 01:59, William W Smith wrote: > Do I need one of the more advanced features of OCaml that I don't currently > understand to use Map the way that I want without writing a whole table > class? I don't even see how I can use Map from inside the table class to > do what I want which would also be acceptable. You need recursive modules, something like this: # module rec StringMap : Map.S = Map.Make(String) and Symbols : sig type t = | IVal of int | StrVal of string | SymTableVal of t StringMap.t end = struct type t = | IVal of int | StrVal of string | SymTableVal of t StringMap.t end;; module rec StringMap : Map.S and Symbols : sig type t = IVal of int | StrVal of string | SymTableVal of t StringMap.t end HTH. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists