From: Diego Olivier Fernandez Pons <Diego.FERNANDEZ_PONS@etu.upmc.fr>
To: Jon Harrop <jon@ffconsultancy.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Set union/inter/diff efficiency
Date: Wed, 27 Jul 2005 11:42:21 +0200 (DST) [thread overview]
Message-ID: <Pine.A41.4.44.0507271125550.3448846-100000@ibm1> (raw)
In-Reply-To: <200507271012.02020.jon@ffconsultancy.com>
Bonjour,
> Does anyone have any ideas or references on how the union/inter/diff
> functions of the Set module could be optimised by accepting a
> sequence of sets rather than a pair at a time ?
No.
> For example, if A overlaps B overlaps C but A does not overlap C
> then it is probably quicker to compute the union "(A U C) U B"
> rather than "A U B U C".
I remember having discussed with Jean-Christophe Filliâtre of the
[compare] implementation of Xavier Leroy. He noticed that it was a
smart lazy linearization of both sets.
In other words you can see it as if one had put a zipper on each set
and one calls when needed the [next] function.
A = 3 -> 5 -> 6 -> 7 -> 10
B = 3 -> 6 -> 8 -> 13
You can say that A < B at the second call of [next]
I suppose you could do a similar thing for union and intersection with
several sets
A = 3 -> 5 -> 6 -> 7 -> 10
B = 3 -> 6 -> 8 -> 13
C = 2 -> 4 -> 5 -> 6
You can call [next] in such a way that the pointers "jump" to an
interesting point. Here, it would be something like
max/min = 3
C -> 4 (first integer >= 3)
max/min = 4
A -> 5 (first integer >= 4)
max/min = 5
B -> 6 (first integer >= 5)
max/min = 6
C -> 6 (...)
A -> 6 (...)
=> output 6 in the intersection
> Better still, does anyone have a replacement Set module which
> implements this functionality?
I am not aware of any in Caml, SML or Haskell but I may be wrong.
Diego Olivier
next prev parent reply other threads:[~2005-07-27 9:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-07-27 9:12 Jon Harrop
2005-07-27 9:42 ` Diego Olivier Fernandez Pons [this message]
2005-07-27 16:04 ` [Caml-list] " james woodyatt
2005-07-27 17:00 ` james woodyatt
2005-07-27 17:32 ` james woodyatt
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=Pine.A41.4.44.0507271125550.3448846-100000@ibm1 \
--to=diego.fernandez_pons@etu.upmc.fr \
--cc=caml-list@yquem.inria.fr \
--cc=jon@ffconsultancy.com \
/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