From: Chris Hecker <checker@d6.com>
To: caml-list@inria.fr
Subject: [Caml-list] checking for same ctor type?
Date: Wed, 27 Jun 2001 19:40:12 -0700 [thread overview]
Message-ID: <200106280240.TAA14693@smtp2-cm.mail.eni.net> (raw)
What's the right way to check if two variants have the same ctor, but
not necessarily the same values in the ctor parms?
For example, I want to check if both data_types are Strings:
type data_type =
String of string
| Float of float
let a = String "foo"
let b = String "bar"
let c = Float 2.0
let ctor_equal a b = ???
ctor_equal a b = true
ctor_equal a c = false
I can think of a couple definitions of ctor_equal, one using
Hashtbl.hash_param 1 1 and one using Obj.tag (which both appear to be
doing the same thing). Both of these seem a bit cheesy and
implementation dependent.
Is there a better way?
Chris
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
next reply other threads:[~2001-06-28 2:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-06-28 2:40 Chris Hecker [this message]
2001-06-28 2:55 ` Brian Rogoff
[not found] ` <Pine.BSF.4.21.0106271950090.28760-100000@shell5.ba.best.co m>
2001-06-28 3:06 ` Chris Hecker
2001-06-29 13:14 ` Chris Quinn
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=200106280240.TAA14693@smtp2-cm.mail.eni.net \
--to=checker@d6.com \
--cc=caml-list@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