From: William W Smith <sesquized@sbcglobal.net>
To: caml-list@yquem.inria.fr
Subject: symbol table containing symbol tables
Date: Tue, 2 Jan 2007 17:59:26 -0800 (PST) [thread overview]
Message-ID: <886949.65043.qm@web82112.mail.mud.yahoo.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1188 bytes --]
In pidgin OCaml I'd like to write something like
type complicated =
IVal of int
| StrVa, of string
| SymTableVal of symTable
and
symTable = Map(string -> complicated)
I tried many variations on using the Map module to implement a recursive data structure like this. I failed miserably. (The above wasn't the syntax I ever used, but it gets the idea across.)
However, when I create an object
class [ 'key, 'content ] table : ('key -> 'key -> int) ->
object
,,,
end
I can successfully declare
type complicated =
IVal of int
| StrVal of string
| SymTableVal of (string, complicated) table
that does what I want. Ithis isn't the whole declaration of complicated, but I believe once I get this declaration working, the more quirky variations work too.
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.
I don't want to have to break open the Map module to modify it and thus change the licensing of my final program.
Thanks
Bill
[-- Attachment #2: Type: text/html, Size: 1434 bytes --]
next reply other threads:[~2007-01-03 1:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-03 1:59 William W Smith [this message]
2007-01-03 2:26 ` [Caml-list] " Jon Harrop
2007-01-03 2:33 ` 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=886949.65043.qm@web82112.mail.mud.yahoo.com \
--to=sesquized@sbcglobal.net \
--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