On Fri, Sep 21, 2012 at 8:25 AM, Christopher Howard <span dir="ltr">&lt;<a href="mailto:christopher.howard@frigidcode.com" target="_blank">christopher.howard@frigidcode.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

But this seems rather clunky, especially if I want to attach the values in the new list to variable names afterwards. 
</blockquote><div><br></div><div>Agreed. Haskell is not Lisp, so there&#39;s no attachment (TH notwithstanding) to variable names [&#39;a&#39;..&#39;z&#39;] if that&#39;s what you&#39;re thinking. </div><div><br></div><div>

Could you provide the concrete scenario of what you&#39;re trying to achieve?</div><div><br></div><br><div>-- Kim-Ee<br>
<br><br><div class="gmail_quote">On Fri, Sep 21, 2012 at 8:25 AM, Christopher Howard <span dir="ltr">&lt;<a href="mailto:christopher.howard@frigidcode.com" target="_blank">christopher.howard@frigidcode.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have a code situation similar to this simplified one: Let&#39;s say that<br>
I&#39;ve got a value v that is a Maybe type, and values x, y, and z that are<br>
not. x, y, and z are dependent on the value inside v. So I must provide<br>
default values for x, y, and z. An additional complication is that every<br>
calculation returns a new (possibly different) value for v. So, I could<br>
do something like this:<br>
<br>
code:<br>
--------<br>
let (v&#39;, x) = case v of<br>
                Nothing -&gt; (Nothing, defaultValueOfX)<br>
                Just vValue -&gt; f vValue in<br>
let (v&#39;&#39;, y) = case v&#39; of<br>
                 Nothing -&gt; (Nothing, defaultValueOfY)<br>
                 Just vValue -&gt; g vValue in<br>
let (v&#39;&#39;&#39;, z) = case v&#39;&#39; of<br>
                  Nothing -&gt; (Nothing, defaultValueOfZ)<br>
                  Just vValue -&gt; h vValue in<br>
--------<br>
<br>
(f, g, h represent the calculations I am performing.) In the end, I need<br>
the values of x, y, and z, and the last v value.<br>
<br>
Obviously, the above solution is not very elegant, especially if I add a<br>
few more variables. My other thought was some kind of fold operation,<br>
where I store the functions (calculations) and the default values in a<br>
list, and then fold over the list, applying subsequent values of v or<br>
returning default values, as appropriate. But this seems rather clunky,<br>
especially if I want to attach the values in the new list to variable<br>
names afterwards.<br>
<br>
Is there a better approach?<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
<a href="http://frigidcode.com" target="_blank">frigidcode.com</a><br>
<a href="http://indicium.us" target="_blank">indicium.us</a><br>
<br>
</font></span><br>_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
<br></blockquote></div><br></div>