From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by pauillac.inria.fr; Mon, 28 Mar 94 19:41:54 +0200 Received: by pauillac.inria.fr; Mon, 28 Mar 94 19:41:08 +0200 From: Pierre Weis Message-Id: <9403281741.AA05465@pauillac.inria.fr> Subject: using sets To: caml-list@pauillac.inria.fr Date: Mon, 28 Mar 1994 19:41:08 +0200 (MET DST) X-Mailer: ELM [version 2.4 PL21] Content-Type: text/plain Sender: weis@pauillac.inria.fr Hello, > type Lien = {A_lien : Noeud ref ; B_lien :Noeud ref };; > and now I would like to use sets of "Liens". > I don't know how to define a total order over references You cannot hope to write such a function, if it reads the contents of the references, since further assignments to the references can change the ordering of the references. The only way seems to compare their adresses independantly of their contents, but due to the gc, these adresses may change. If the gc changes these adresses consistently with the ordering, then a piece of magic could be written, otherwise I don't know how to deal with the problem. However, the best solution is yours: simply add a field to compare elements of type Lien! Pierre Weis PS: Have you good reasons to use records with fields containing references, instead of records with mutable fields ? If no, just remove the refs and add a new field to compare the Lien values: your Lien data will be more compact than they are now, and you'll have no more problems to compare them!