<?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="2006/02/abd46f59560ffbc55f9266923fb44a10"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-26T20:51:26"
  subject="Re: [Caml-list] algorithm question"
  prev="2006/02/69ca8493c1f140556f85214ca9df04fc"
  next="2006/02/042401b65f46857468db67fa9a401b16"
  prev-in-thread="2006/02/d4f878af9a94787607a08fe0fc70f5b6"
  next-in-thread="2006/02/042401b65f46857468db67fa9a401b16"
  prev-thread="2006/02/1681fddd9168a27c9d00d28b96b4af41"
  next-thread="2006/02/caba8251dd7fcc522c2f8ffb14418b50"
  root="../../"
  period="month"
  listname="caml-list"
  title="Archives of the Caml mailing list">

<thread subject="algorithm question">
<msg 
  url="2006/02/da72632e1d8178a78fd1184bc05904b2"
  from="Michael Wohlwend &lt;micha-1@f...&gt;"
  author="Michael Wohlwend"
  date="2006-02-26T20:21:14"
  subject="algorithm question">
<msg 
  url="2006/02/69ca8493c1f140556f85214ca9df04fc"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2006-02-26T20:48:03"
  subject="Re: [Caml-list] algorithm question">
<msg 
  url="2006/02/d4f878af9a94787607a08fe0fc70f5b6"
  from="Michael Wohlwend &lt;micha-1@f...&gt;"
  author="Michael Wohlwend"
  date="2006-02-26T21:26:56"
  subject="Re: [Caml-list] algorithm question">
</msg>
</msg>
<msg 
  url="2006/02/abd46f59560ffbc55f9266923fb44a10"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-26T20:51:26"
  subject="Re: [Caml-list] algorithm question">
<msg 
  url="2006/02/042401b65f46857468db67fa9a401b16"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2006-02-26T21:03:04"
  subject="Re: [Caml-list] algorithm question">
</msg>
<msg 
  url="2006/02/1c19946b3ecb11358aba733f85dba692"
  from="Jean-Christophe Filliatre &lt;filliatr@l...&gt;"
  author="Jean-Christophe Filliatre"
  date="2006-02-27T10:31:10"
  subject="Re: [Caml-list] algorithm question">
<msg 
  url="2006/02/3f0f8f1185a34b2b4ddc652d019d62d9"
  from="Diego Olivier Fernandez Pons &lt;Diego.FERNANDEZ_PONS@e...&gt;"
  author="Diego Olivier Fernandez Pons"
  date="2006-02-27T11:02:41"
  subject="Re: [Caml-list] algorithm question">
</msg>
<msg 
  url="2006/02/58fc7f8e56e910d13a207ef052e798b2"
  from="Brian Hurt &lt;bhurt@s...&gt;"
  author="Brian Hurt"
  date="2006-02-27T14:48:35"
  subject="Re: [Caml-list] algorithm question">
</msg>
</msg>
</msg>
</msg>
</thread>

<contents>


On Sun, 26 Feb 2006, Michael Wohlwend wrote:

&gt;
&gt; I want to implement the dancing link algorithm as described here:
&gt; http://www-cs-faculty.stanford.edu/~knuth/papers/dancing-color.ps.gz
&gt;
&gt; has someone an idea if there is an equally fast way to implent this more
&gt; functional? The method in the paper seems pretty good, just adjusting a the
&gt; linksfields of the structure...

It's solving a problem that doesn't show up in functional programming.

Basically, he's trying to avoid having to duplicate an entire data 
structure in order to preserve a snapshot of the data structure to support 
undoing operations.  With a purely functional (aka applicative aka 
immutable) data structure, modifications are not destructive.  After you 
add a new element into a map, for example, the old map is still valid and 
not changed.  So you can support undoing operations by just keeping 
references to the old copy of the data structure around, and dropping the 
new (modified) data structure and returning to the old one.

Also, he's skating a fine edge.  Operation (2) implicitly assumes that 
L[x] and R[x] have not been modified before the reinsertion happens.  If 
they have been modified, the results depend upon exactly how they've been 
modified, but can easily lead to corrupt data structures.  If you're 
precisely backtracking, it'll be OK, other than that...

Brian

</contents>

</message>

