From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id EAA07738; Thu, 28 Jun 2001 04:40:16 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id EAA07691 for ; Thu, 28 Jun 2001 04:40:15 +0200 (MET DST) Received: from smtp2-cm.mail.eni.net (smtp2-cm.mail.eni.net [216.133.226.135]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f5S2eEH02451 for ; Thu, 28 Jun 2001 04:40:14 +0200 (MET DST) Received: from CHECKERATH (node-d8e9cca2.powerinter.net [216.233.204.162]) by smtp2-cm.mail.eni.net (8.9.3/8.9.3) with SMTP id TAA14693 for ; Wed, 27 Jun 2001 19:40:12 -0700 Date: Wed, 27 Jun 2001 19:40:12 -0700 Message-Id: <200106280240.TAA14693@smtp2-cm.mail.eni.net> From: Chris Hecker To: caml-list@inria.fr Subject: [Caml-list] checking for same ctor type? Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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