[Haskell-cafe] question regarding the $ apply operator

Brandon Allbery allbery.b at gmail.com
Tue Jul 19 08:22:47 CEST 2011


On Tue, Jul 19, 2011 at 02:16, Ting Lei <tinlyx at hotmail.com> wrote:

> I have a naive question regarding the basic use of the $ operator, and I am
> confused why certain times it doesn't seem to work.
> e.g.
> The following works:
>
> applySkip i f ls = (take i) ls ++ f (drop i ls)
>
> But the following doesn't:
>
> applySkip i f ls = (take i) ls ++ f $ drop i ls
>

($) has lower precedence than almost every other operator, so your "doesn't
work" translates to

> applySkip i f ls = ((take i) ls ++ f) $ (drop i ls)

-- 
brandon s allbery                                      allbery.b at gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110719/0d081bc9/attachment.htm>


More information about the Haskell-Cafe mailing list