<?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/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"
  prev="2003/11/fd186d3b0f3181706aa9233656cdd501"
  next="2003/11/e2fb8ff91b241e56cbb230b4a245f99d"
  prev-in-thread="2003/11/084dc18069992dc2bb611418ba46e2c0"
  next-in-thread="2003/11/184f6a940f38b467106a0ab10f62e65d"
  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 Sat, 8 Nov 2003, Dustin Sallings wrote:

&gt; type 'a link = Nothing | Link of 'a t;;
&gt; 
&gt; type 'a t = {
&gt;      data: 'a;
&gt;      mutable prev: 'a link;
&gt;      mutable next: 'a link;
&gt; };;
&gt; 
&gt; 	But, link and t don't know about each other.  How does one go about 
&gt; doing this kind of thing in ocaml?
&gt;

Use and:

type 'a link = Nothing | Something of 'a t 
and 'a t = { data: 'a; mutable next: 'a link; mutable prev: 'a link }

The other alternative is to not redefine option:

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

Brian

-- 
"Usenet is like a herd of performing elephants with diarrhea -- massive,
difficult to redirect, awe-inspiring, entertaining, and a source of
mind-boggling amounts of excrement when you least expect it."
                                - Gene Spafford 
Brian

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

