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=1.3 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 2479EBC0A for ; Wed, 3 Jan 2007 03:33:20 +0100 (CET) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.172]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l032XJWI012639 for ; Wed, 3 Jan 2007 03:33:19 +0100 Received: by ug-out-1314.google.com with SMTP id q2so6155726uge for ; Tue, 02 Jan 2007 18:33:19 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=Esn+SUV3Z+a5QemOpYvH97OvrLpPquGMkhdVORGNdWFx2rZOpfnjoACzqjDvGO0e7Z0qxMLUsBH6eQlm11FTpHBcxpZS17lkthtyTvAjKhCkXQDBGpJpEurat4c5luVlHddNHnh2baY8lihXnU4TsCYDFwt8kpCLAAa8Lhhez28= Received: by 10.78.97.7 with SMTP id u7mr2094401hub.1167791599484; Tue, 02 Jan 2007 18:33:19 -0800 (PST) Received: by 10.78.159.17 with HTTP; Tue, 2 Jan 2007 18:33:19 -0800 (PST) Message-ID: Date: Wed, 3 Jan 2007 15:33:19 +1300 From: "Jonathan Roewen" To: "Jon Harrop" Subject: Re: [Caml-list] symbol table containing symbol tables Cc: caml-list@yquem.inria.fr In-Reply-To: <200701030226.57444.jon@ffconsultancy.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <886949.65043.qm@web82112.mail.mud.yahoo.com> <200701030226.57444.jon@ffconsultancy.com> X-j-chkmail-Score: MSGID : 459B15EF.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 459B15EF.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; recursive:01 ocaml:01 recursive:01 sig:01 struct:01 sig:01 ocaml:01 beginner's:01 bug:01 frog:98 beginners:01 wrote:01 wrote:01 rec:01 rec:01 Ooh, that's clever. An actual use case for recursive modules that's also simple :-) On 1/3/07, Jon Harrop wrote: > 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 > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs >