caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [Caml-list] enums in OCaml?
@ 2001-06-13 20:50 leary
  0 siblings, 0 replies; 11+ messages in thread
From: leary @ 2001-06-13 20:50 UTC (permalink / raw)
  To: caml

Yup, that's the functionality I was looking for.  I wonder, tho' ('cause
I'm like that...), since plain ol' named variables would be shorter, what
is the argument for using sum types w/ pattern matching instead?

On Wed, Jun 13, 2001 at 10:46:36AM +0200, David Mentre wrote:
> Maybe you should have a look at source code of standard libraries. They
> are remarkably concise and well written.

Thanks for the link, I'd passed that over (!) as a reference for examples.
Which brings up a question: Is there anyone working on annotating the
standard/core libraries.  Might do for OCaml a bit of the magic that the
classic work did for Unix and C (I forget the title/author; someone?).

> For example, operations on lists (List module):
> http://camlcvs.inria.fr/cgi-bin/cvsweb.cgi/ocaml/stdlib/list.ml?rev=1.27&content-type=text/x-cvsweb-markup
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread
* [Caml-list] enums in OCaml?
@ 2001-06-13  2:21 leary
  2001-06-13  7:37 ` David Mentre
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: leary @ 2001-06-13  2:21 UTC (permalink / raw)
  To: caml

What's the right way to make something like C's enums in OCaml.  I found a
couple references to sum types online and in the manual and caml light
tutorial, but none of it was really what I'm looking for: alias a number
with a name, hopefully conveniently.  Should I just make some named
variables?  That seems a bit verbose and un-clever.
-------------------
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


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2001-06-14 17:33 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-13 20:50 [Caml-list] enums in OCaml? leary
  -- strict thread matches above, loose matches on Subject: below --
2001-06-13  2:21 leary
2001-06-13  7:37 ` David Mentre
2001-06-13  8:20   ` leary
     [not found] ` <200106130751.f5D7pbL11758@ionie.inria.fr>
2001-06-13  8:18   ` leary
2001-06-13  8:46     ` David Mentre
2001-06-14  8:15 ` leary
2001-06-14  8:41   ` Chris Hecker
2001-06-14  8:53   ` Jacques Garrigue
2001-06-14  9:12   ` Francisco Valverde Albacete
2001-06-14 13:04   ` Chris Quinn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).