<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 4 May 2013 19:33, Costello, Roger L. <span dir="ltr">&lt;<a href="mailto:costello@mitre.org" target="_blank">costello@mitre.org</a>&gt;</span> wrote:<br><br>

&lt;snip&gt;<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<br>
But then I saw this in an article:<br>
<br>
        ($ 3) odd<br>
<br>
What does ($ 3) mean? I thought the first argument to ($) is a function?<br>
<br>
I checked the type of ($ 3) and it is:<br>
<br>
        ($ 3) :: Num a =&gt; (a -&gt; b) -&gt; b<br>
<br>
I don&#39;t understand that. How did that happen? Why can I take a second argument and wrap it in parentheses with ($) and then that second argument pops out and becomes the argument to a function?<br></div></blockquote>

<div><br></div><div>These are called operator sections. Take a look at <a href="http://www.haskell.org/haskellwiki/Section_of_an_infix_operator">http://www.haskell.org/haskellwiki/Section_of_an_infix_operator</a><br></div>

<div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div>
<br>
I decided to see if other functions behaved similarly. Here is the type signature for the &quot;map&quot; function:<br>
<br>
        map :: (a -&gt; b) -&gt; [a] -&gt; [b]<br>
<br>
That looks very similar to the type signature for ($). So, I reasoned, I should be able to do the same kind of thing:<br>
<br>
        let list=[1,2,3]<br>
        (map list) odd<br>
<br>
But that fails. Why? Why does that fail whereas a very similar looking form succeeds when ($) is used?<br clear="all"></div></blockquote><div><br></div><div>Because (map list) is an ordinary function application since operator sections apply only to infix operators. On the other hand, had you written (`map` list), it would have worked as you expected. <br>

</div></div><br>λ. let list = [1, 2, 3]<br>λ. (`map` list) odd<br>[True,False,True]<br><br>-- <br>Denis Kasak
</div></div>