From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] symbol table containing symbol tables
Date: Wed, 3 Jan 2007 02:26:57 +0000 [thread overview]
Message-ID: <200701030226.57444.jon@ffconsultancy.com> (raw)
In-Reply-To: <886949.65043.qm@web82112.mail.mud.yahoo.com>
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
next prev parent reply other threads:[~2007-01-03 2:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-03 1:59 William W Smith
2007-01-03 2:26 ` Jon Harrop [this message]
2007-01-03 2:33 ` [Caml-list] " Jonathan Roewen
2007-01-03 2:29 ` Jonathan Roewen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200701030226.57444.jon@ffconsultancy.com \
--to=jon@ffconsultancy.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox