<br>
<br><tt><font size=2>haskell-cafe-bounces@haskell.org wrote on 03/06/2007
02:43:03 PM:<br>
<br>
&gt; Usually, I can do this, but today, my brain is weak, and I'm just
trying to <br>
&gt; get this piece of code out the door. &nbsp;My code looks like this:<br>
&gt; <br>
&gt; weight = sum (IntMap.elems (IntMap.intersectionWith <br>
&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(\x y -&gt; x*y) queryVector
rationalProjection)) <br>
&gt; <br>
&gt; I know that this will work (ignoring indentation):<br>
&gt; <br>
&gt; sum $ IntMap.elems $ IntMap.intersectionWith (\x y -&gt; x*y) queryVector
<br>
&gt; rationalProjection<br>
&gt; <br>
&gt; But why won't this?:<br>
&gt; <br>
&gt; sum . IntMap.elems . IntMap.IntersectionWith ...<br>
&gt; <br>
&gt; Is there a difference between the &quot;elegance&quot; of function
composition versus <br>
&gt; application?<br>
&gt;</font></tt>
<br><tt><font size=2>I assume your really asking why something like: </font></tt>
<br>
<br><tt><font size=2>&nbsp; &nbsp; (*) $ 2 $ 3</font></tt>
<br>
<br><tt><font size=2>won't work? If so, the reason is that $ associates
to the right. So you should write:</font></tt>
<br>
<br><tt><font size=2>&nbsp; &nbsp; ((*) $ 2) $ 3</font></tt>
<br>
<br><tt><font size=2>If not, could you give the full expression which doesn't
work?</font></tt>
<br>
<br><tt><font size=2>-Jeff</font></tt>
<br>
<br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">---</span><br>
<br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">This e-mail may contain confidential and/or privileged information. If you </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">are not the intended recipient (or have received this e-mail in error) </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">please notify the sender immediately and destroy this e-mail. Any </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">unauthorized copying, disclosure or distribution of the material in this </span><br>
<span style="font-family:sans-serif,helvetica; font-size:10pt; color:#000000">e-mail is strictly forbidden.</span><br>