If you&#39;re using the LPM monad, then this is about as easy as that: you use<br><br>do    (x1:x2:x3:_) &lt;- newVariables<br>       ......<br><br>I mean, run is equivalent to<br><br>run f = execLPM (newVariables &gt;&gt;= put . f)<br>

<br>so...yeah, I think this is a reasonable solution.<br><br>Alternatively, I&#39;m almost positive there&#39;s a monad out there that lets you draw on unique values.  It&#39;d look something like<br><br>type Variable = Int<br>

newtype UniqueM a = UniqueM (Variable -&gt; (Variable, a))<br><br>-- monad instance, etc.<br><br>getUnique :: UniqueM Variable<br>getUnique = UniqueM (\ x -&gt; (x+1, x))<br><br>Then you can use the LPT monad transformer to construct a linear program around this, just by working in the &quot;LPT Variable c UniqueM&quot; monad.<br>

<br>That&#39;s actually a nicer solution than my current implementation.  I&#39;ll do that, then...<br><br clear="all">Louis Wasserman<br><a href="mailto:wasserman.louis@gmail.com">wasserman.louis@gmail.com</a><br><a href="http://profiles.google.com/wasserman.louis">http://profiles.google.com/wasserman.louis</a><br>


<br><br><div class="gmail_quote">On Mon, Mar 1, 2010 at 9:29 AM, Henning Thielemann <span dir="ltr">&lt;<a href="mailto:lemming@henning-thielemann.de">lemming@henning-thielemann.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<div class="im"><br>
On Sun, 28 Feb 2010, Louis Wasserman wrote:<br>
<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
It&#39;s an expensive operation, though -- since I don&#39;t track the set of all<br>
variables as the LP is built, I need to construct the set of all variables<br>
before generating new ones -- so it&#39;s recommended that you get all the<br>
variables you need in one or two passes.<br>
</blockquote>
<br></div>
Then you might prefer a single operation that generates all variables and runs an enclosed problem on them:<br>
<br>
run :: ([Variable] -&gt; LP a) -&gt; LP a<br>
<br>
<br>
Use as<br>
<br>
run $ \x0:x1:x2:_ -&gt; do<br>
   ...<br>
</blockquote></div><br>