<?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/084dc18069992dc2bb611418ba46e2c0"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-08T11:02:32"
  subject="Re: [Caml-list] removing an item from a list efficiently"
  prev="2003/11/32140dc8d0aefcc1084f7d71249259ed"
  next="2003/11/80ecbd8e48d00579987a885cae805996"
  prev-in-thread="2003/11/32140dc8d0aefcc1084f7d71249259ed"
  next-in-thread="2003/11/c3c337dbb5441234608baefc94d522c1"
  prev-thread="2003/11/140c9fadd8e2355539503a016bc1e217"
  next-thread="2003/11/810f9d2fb53a5d64dcf1e65d5252ea26"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="[Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/8bac1133214edc5aaff0c5dae8053b9e"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-07T09:32:27"
  subject="[Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/35bb4778a8df1590c7a455f7ccde6d41"
  from="jrouquie@e..."
  author="jrouquie@e..."
  date="2003-11-07T09:49:13"
  subject="Re: [Caml-list] removing an item from a list efficiently">
</msg>
<msg 
  url="2003/11/1b659ba377258e8559706506c2db6f58"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-11-07T12:46:23"
  subject="Re: [Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/abff800f267cf8fbd094693a8b321bf2"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-08T08:50:00"
  subject="Re: [Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/c7d99f81f6a9a73503416cb0a2eae8ff"
  from="Stefano Zacchiroli &lt;zack@b...&gt;"
  author="Stefano Zacchiroli"
  date="2003-11-08T09:16:09"
  subject="Re: [Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/46359372e8c3fe20eb2053f0ae783117"
  from="Dustin Sallings &lt;dustin@s...&gt;"
  author="Dustin Sallings"
  date="2003-11-09T01:13:50"
  subject="Re: [Caml-list] removing an item from a list efficiently">
</msg>
</msg>
<msg 
  url="2003/11/32140dc8d0aefcc1084f7d71249259ed"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-08T10:59:15"
  subject="Re: [Caml-list] removing an item from a list efficiently">
<msg 
  url="2003/11/084dc18069992dc2bb611418ba46e2c0"
  from="Oleg Trott &lt;oleg_trott@c...&gt;"
  author="Oleg Trott"
  date="2003-11-08T11:02:32"
  subject="Re: [Caml-list] removing an item from a list efficiently">
</msg>
</msg>
<msg 
  url="2003/11/c3c337dbb5441234608baefc94d522c1"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-08T18:00:04"
  subject="Re: [Caml-list] removing an item from a list efficiently">
</msg>
</msg>
</msg>
<msg 
  url="2003/11/184f6a940f38b467106a0ab10f62e65d"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2003-11-07T15:51:55"
  subject="Re: [Caml-list] removing an item from a list efficiently">
</msg>
</msg>
</thread>

<contents>
On Saturday 08 November 2003 05:59 am, Oleg Trott wrote:
&gt; On Saturday 08 November 2003 03:49 am, Dustin Sallings wrote:
&gt; &gt; On Nov 7, 2003, at 4:46, Stefano Zacchiroli wrote:
&gt; &gt; &gt; IMHO to implement an LRU policy, lists are not the best structures due
&gt; &gt; &gt; to the O(n) limit above. You can consider standard heaps (assuming you
&gt; &gt; &gt; have an upper bound on the number of entries) or binomial heaps (you
&gt; &gt; &gt; can
&gt; &gt; &gt; find an implementation in Okasaki's book).
&gt; &gt;
&gt; &gt; 	This is really what I was asking, whether ocaml lists could be
&gt; &gt; appropriate.
&gt; &gt;
&gt; &gt; 	I'm having difficulty figuring out how to implement a double linked
&gt; &gt; list, though.  I want something like this:
&gt; &gt;
&gt; &gt; type 'a link = Nothing | Link of 'a t;;
&gt; &gt;
&gt; &gt; type 'a t = {
&gt; &gt;      data: 'a;
&gt; &gt;      mutable prev: 'a link;
&gt; &gt;      mutable next: 'a link;
&gt; &gt; };;
&gt; &gt;
&gt; &gt; 	But, link and t don't know about each other.  How does one go about
&gt; &gt; doing this kind of thing in ocaml?
&gt;
&gt; I've read your mind, and I think what you are trying to do is
&gt;
&gt; type 'a t = {data: 'a; mutable prev: 'a option; mutable next: 'a option};;
&gt;
&gt; or you can just do a web search for "doubly-linked list". It's out there.

I meant 

type 'a t = {data: 'a; mutable prev: 'a t option; mutable next: 'a t option};;

-- 
Oleg Trott &lt;oleg_trott@columbia.edu&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

</contents>

</message>

