English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] Design advice
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2002-09-28 (22:01)
From: John Gerard Malecki <johnm@a...>
Subject: Re: [Caml-list] Design advice
This thread reminds me to ask if are there any guarantees for ordering
of variant types?  Although the implementation indicates that with

  type card = Number of int | Jack | Queen | King | Ace

Jack < Queen and Queen < King it also says that Ace < Number 0.  I can
see what is going on with the implementation.  I'm curious if there
are any ordering guarantees that I can take advantage of?  Since the
documentation is silent on this point I doubt it.

Oh, It does seems as if tuples, arrays and lists are always compared
"from left to right".  This can be handy when sorting multi-
dimensional data.  This seems like a "more natural" ordering than for
variants but, once again, can this ordering be guaranteed for all
ocaml programs?

To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners