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 KAA11852; Thu, 14 Jun 2001 10:15:54 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA11740 for ; Thu, 14 Jun 2001 10:15:52 +0200 (MET DST) Received: from ip208.usw4.rb1.pdx.nwlink.com (ip208.usw4.rb1.pdx.nwlink.com [209.20.133.208]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id f5E8Fpj00725 for ; Thu, 14 Jun 2001 10:15:51 +0200 (MET DST) Received: (qmail 28632 invoked by uid 500); 14 Jun 2001 08:15:50 -0000 Date: Thu, 14 Jun 2001 01:15:50 -0700 From: leary@nwlink.com To: caml Subject: Re: [Caml-list] enums in OCaml? Message-ID: <20010614011550.A28578@jean> References: <20010612192126.B24440@jean> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20010612192126.B24440@jean>; from leary@nwlink.com on Tue, Jun 12, 2001 at 07:21:26PM -0700 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Ok, I see how I can do this with a sum type and a function on it; but that's also a lot of repetitive setup. Seems I could also just make a function that acted on strings: let message_to = function "accel" -> 1 | "stop" -> 0 | _ -> -1;; ...which is perhaps less typing/editing up front, but a bit of a pain to type all the "s in the code. So, what's so wrong with just using variables? let Accel = 1;; let Stop = 0;; seems pretty short to write and shortest to use... Am I missing something ( elegant | obvious )? Is that just ugly? thanks ------------------- 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