caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Pierre Weis <weis@pauillac.inria.fr>
To: caml-list@pauillac.inria.fr
Subject: using sets
Date: Mon, 28 Mar 1994 19:41:08 +0200 (MET DST)	[thread overview]
Message-ID: <9403281741.AA05465@pauillac.inria.fr> (raw)

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!




             reply	other threads:[~1994-03-28 17:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-03-28 17:41 Pierre Weis [this message]
  -- strict thread matches above, loose matches on Subject: below --
1994-03-28 12:37 Eric Dujardin
1994-03-28 21:50 ` Xavier Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9403281741.AA05465@pauillac.inria.fr \
    --to=weis@pauillac.inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).