<div dir="ltr"><font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif">I gave this concrete example a couple of messages ago.</font></font></font><div><font color="#003333"><font size="2"><font face="trebuchet ms,sans-serif"><br>

</font></font></font></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"><div><span class="Apple-style-span" style="font-family: &#39;trebuchet ms&#39;, sans-serif; border-collapse: collapse; "><font class="Apple-style-span" color="#000099">Let&#39;s assume that instead of keeping for each cage the Operation and target number we pre-compute all the combinations of values that will satisfy the cage.  For example, assume that in a 4x4 game, we have a cage that refers to cells C1 and C2 and that the cage requires those two cells to produce a value of 2 using division, </font></span></div>

<div><span class="Apple-style-span" style="font-family: &#39;trebuchet ms&#39;, sans-serif; border-collapse: collapse; "><font class="Apple-style-span" color="#000099"><br></font></span></div><div><span style="font-family: &#39;trebuchet ms&#39;, sans-serif; "><font class="Apple-style-span" color="#000099">Pre-computing the possibilities, we store [(1, 2), (2, 1), (2, 4), (4, 2)] in this cage. </font></span></div>

<div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="trebuchet ms,sans-serif"><font class="Apple-style-span" color="#000099"><br></font></font></div>

</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="trebuchet ms,sans-serif"><font class="Apple-style-span" color="#000099">The cage points to the two cells it constrains, and each cell points to the cage that constrains it. </font></font></div>

</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="trebuchet ms,sans-serif"><font class="Apple-style-span" color="#000099"><br></font></font></div>

</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="trebuchet ms,sans-serif"><font class="Apple-style-span" color="#000099">When a cell (say C1) gets a value of (say) 2, we want to change the cage to be [(2, 1), (2, 4)]. But when that happens, it&#39;s necessary to change cell C2 to point to the new cage -- and of course since the cell was changed the construct that held that cell has to be changed also.</font></font></div>

</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="trebuchet ms,sans-serif"><font class="Apple-style-span" color="#000099"><br></font></font></div>

</span></div><div><span class="Apple-style-span" style="border-collapse: collapse; "><div style="font-family: arial, sans-serif; "><font face="&#39;trebuchet ms&#39;, sans-serif"><font class="Apple-style-span" color="#000099">It&#39;s a bit of a pain to write the code to do all that.  This isn&#39;t to say that the code will take that long to run or that it will use excessive memory -- only that it feels like one is being forced to write code that one shouldn&#39;t have to write. </font></font></div>

</span></div></blockquote><div><span class="Apple-style-span" style="border-collapse: collapse; "><div><font class="Apple-style-span" size="4" style="color: rgb(136, 136, 136); font-family: arial, sans-serif; "><span class="Apple-style-span" style="font-size: 14.1667px;"><font color="#888888"></font></span></font></div>

<div style="font-size: 14.1667px; color: rgb(136, 136, 136); font-family: arial, sans-serif; "><font color="#003333" face="&#39;trebuchet ms&#39;, sans-serif"><br></font></div></span><div dir="ltr"><font><font face="&#39;trebuchet ms&#39;, sans-serif"><i><font color="#003333"><br>

-- Russ </font></i></font></font></div>
<br><br><div class="gmail_quote">On Thu, Nov 25, 2010 at 9:42 AM, Ozgur Akgun <span dir="ltr">&lt;<a href="mailto:ozgurakgun@gmail.com">ozgurakgun@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">

<div class="im"><br><div class="gmail_quote">On 25 November 2010 17:12, Russ Abbott <span dir="ltr">&lt;<a href="mailto:russ.abbott@gmail.com" target="_blank">russ.abbott@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; ">


<font color="#003333" face="&#39;trebuchet ms&#39;, sans-serif">Thanks, Patrick. I&#39;m disappointed, though, that no one has actually responded to my question. It wasn&#39;t how to solve KenKen. It was how best to deal with quasi-mutable data structures. </font><br clear="all">


<font color="#888888">

<div dir="ltr"></div></font></blockquote></div><br></div>You gave an example about how your data structure look like, but I haven&#39;t seen an example  case of &quot;quasi-mutating&quot; an expression of such data structures. If you give a concrete example, people can suggest better ways of doing it, if there are any.<br clear="all">


<br><div>Best,</div><div>Ozgur</div>
</blockquote></div><br></div></div>