From: "Bünzli Daniel" <daniel.buenzli@epfl.ch>
To: Niko Matsakis <niko@alum.mit.edu>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Extracting common information
Date: Thu, 24 May 2007 13:44:15 +0200 [thread overview]
Message-ID: <D4FC76EC-BAEA-475A-A714-EC7D862B83B6@epfl.ch> (raw)
In-Reply-To: <E7A015DC-1733-4752-BE63-78113DBA3D5B@alum.mit.edu>
Another solution is to use polymorphic variants [1] :
type 'ud type_tree = [ `Primitive of 'ud * string |
`Pointer of 'ud * 'ud type_tree ]
type 'ud expr_tree = [ `Unary of 'ud * string * 'ud expr_tree |
`Binary of 'ud * string * 'ud expr_tree * 'ud
expr_tree ]
type 'ud any_tree = [ 'ud type_tree | 'ud expr_tree ]
let ud = function
| `Primitive (ud, _) | `Pointer (ud, _) | `Unary (ud, _, _) | `Binary
(ud, _, _, _) -> ud
Daniel
[1] http://caml.inria.fr/pub/docs/manual-ocaml/manual006.html#htoc41
next prev parent reply other threads:[~2007-05-24 11:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-05-24 11:04 Niko Matsakis
2007-05-24 11:31 ` [Caml-list] " Romain
2007-05-24 11:44 ` Bünzli Daniel [this message]
2007-05-24 14:09 ` skaller
2007-05-24 14:23 ` Stephen Weeks
2007-05-24 18:00 ` Peter Ilberg
2007-05-28 19:00 ` Niko Matsakis
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=D4FC76EC-BAEA-475A-A714-EC7D862B83B6@epfl.ch \
--to=daniel.buenzli@epfl.ch \
--cc=caml-list@yquem.inria.fr \
--cc=niko@alum.mit.edu \
/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