<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE message PUBLIC
  "-//MLarc//DTD MLarc output files//EN"
  "../../mlarc.dtd"[
  <!ATTLIST message
    listname CDATA #REQUIRED
    title CDATA #REQUIRED
  >
]>

  <?xml-stylesheet href="../../mlarc.xsl" type="text/xsl"?>


<message 
  url="2003/11/da696d358ae593a66f88c4f96053e5dc"
  from="Fred Smith &lt;fsmith@m...&gt;"
  author="Fred Smith"
  date="2003-11-07T17:27:29"
  subject="RE: [Caml-list] Efficient and canonical set representation?"
  prev="2003/11/184f6a940f38b467106a0ab10f62e65d"
  next="2003/11/394f41f69a257eeacde18d22bf8fce94"
  next-in-thread="2003/11/a3a5477ee398828c88f87b617b2a8e9c"
  prev-thread="2003/11/3609cc72597a8a20efdcae335433c69f"
  next-thread="2003/11/394f41f69a257eeacde18d22bf8fce94"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="RE: [Caml-list] Efficient and canonical set representation?">
<msg 
  url="2003/11/da696d358ae593a66f88c4f96053e5dc"
  from="Fred Smith &lt;fsmith@m...&gt;"
  author="Fred Smith"
  date="2003-11-07T17:27:29"
  subject="RE: [Caml-list] Efficient and canonical set representation?">
<msg 
  url="2003/11/a3a5477ee398828c88f87b617b2a8e9c"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2003-11-10T13:25:44"
  subject="RE: [Caml-list] Efficient and canonical set representation?">
<msg 
  url="2003/11/603ddddaea687d117252cafb1331d223"
  from="Christophe Raffalli &lt;Christophe.Raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-11-10T13:48:33"
  subject="[Caml-list] Rounding mode">
<msg 
  url="2003/11/e929b20f0d1d60fa83a3e258b722b56f"
  from="Eric Dahlman &lt;edahlman@a...&gt;"
  author="Eric Dahlman"
  date="2003-11-10T14:11:20"
  subject="Re: [Caml-list] Rounding mode">
<msg 
  url="2003/11/961e47bf02647ab3211df3fef8af0162"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-10T17:04:22"
  subject="Re: [Caml-list] Rounding mode">
<msg 
  url="2003/11/78956daed31d6bd15ea553616f84bd1a"
  from="Eric Dahlman &lt;edahlman@a...&gt;"
  author="Eric Dahlman"
  date="2003-11-10T20:36:35"
  subject="Re: [Caml-list] Rounding mode">
<msg 
  url="2003/11/8e821ea8fec9431d896c85e2f2a14314"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-10T22:10:21"
  subject="Re: [Caml-list] Rounding mode">
<msg 
  url="2003/11/41e94f145d604f09aacb6c4947bc279a"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-11-17T21:15:15"
  subject="Re: [Caml-list] Rounding mode">
</msg>
</msg>
<msg 
  url="2003/11/0d75e2b6062f10b09f156d8ac6fd7586"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2003-11-12T17:20:58"
  subject="Re: [Caml-list] Rounding mode">
<msg 
  url="2003/11/885b32addf1eb9719d8a07a920a5ab60"
  from="Eric Dahlman &lt;edahlman@a...&gt;"
  author="Eric Dahlman"
  date="2003-11-13T15:49:11"
  subject="Re: [Caml-list] Rounding mode">
</msg>
<msg 
  url="2003/11/653fcdcc6b26a352eb994c594097f7c2"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2003-11-17T17:04:31"
  subject="Re: [Caml-list] Rounding mode">
</msg>
</msg>
</msg>
</msg>
<msg 
  url="2003/11/775b1eba6ee2960fe6c3b44a4d7b1e87"
  from="Christophe Raffalli &lt;christophe.raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-11-10T20:22:39"
  subject="Re: [Caml-list] Rounding mode">
</msg>
</msg>
<msg 
  url="2003/11/7d8ad9863510e4c4d81cecb131ca3ceb"
  from="Christophe Raffalli &lt;Christophe.Raffalli@u...&gt;"
  author="Christophe Raffalli"
  date="2003-11-12T15:35:05"
  subject="Re: [Caml-list] Rounding mode + extended">
<msg 
  url="2003/11/22994e899a0946856c984ad66f2c32d8"
  from="Xavier Leroy &lt;xavier.leroy@i...&gt;"
  author="Xavier Leroy"
  date="2003-11-13T17:35:42"
  subject="Re: [Caml-list] Rounding mode + extended">
</msg>
</msg>
</msg>
<msg 
  url="2003/11/d73e097c37835a027c40bfb469a54199"
  from="Julien Signoles &lt;Julien.Signoles@l...&gt;"
  author="Julien Signoles"
  date="2003-11-10T19:49:21"
  subject="RE: [Caml-list] Efficient and canonical set representation?">
</msg>
</msg>
</msg>
</thread>

<contents>

Ocaml has a structural comparison function (&lt;=) : 'a -&gt; 'a -&gt; bool.  

But the bigger problem with this approach (as Jean-Baptiste Rouquier) kindly pointed out to me is that insertion takes O(n), not O(log(n)) time. Duh.

-Fred


&gt; -----Original Message-----
&gt; From: owner-caml-list@pauillac.inria.fr 
&gt; [mailto:owner-caml-list@pauillac.inria.fr] On Behalf Of Samuel Lacas
&gt; Sent: Friday, November 07, 2003 10:44 AM
&gt; To: caml-list@inria.fr
&gt; Subject: Re: [Caml-list] Efficient and canonical set representation?
&gt; 
&gt; 
&gt; Fred Smith a écrit 2.2K le Fri, Nov 07, 2003 at 10:27:25AM -0500: # 
&gt; # I guess what you're looking for are sorted arrays:
&gt; #   1) O(log n) lookup and insertion via binary search
&gt; #   2) O(n) union and intersection are simple
&gt; #   3) Equal sets are represented by structurally equivalent objects.
&gt; # 
&gt; # -Fred
&gt; 
&gt; Hmm, except that, if I'm not wrong, it was required the 
&gt; structure to hold any kind of object. Sorted arrays require 
&gt; the elements to be sortable. Using the hash of the objects 
&gt; may be an answer ?
&gt; 
&gt; sL
&gt; 
&gt; -------------------
&gt; 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

-------------------
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

</contents>

</message>

