Thanks, Brandon, That's a very clear explanation. I remembered that it's low, but forgot that it's this low. Maybe it's because of my mis-understanding that in C, infix operators have lower precedence.
Just curious, the following is not allowed in Haskell either for the same reason. applySkip i f ls = (take i) ls ++ $ f $ drop i ls I read somewhere that people a couple of hundreds of years ago can manage to express things using ($)-like notation without any parenthesis at all. Is it possible to define an operator to achieve this which works with infix operators? If so, then ($) and parentheses are then really equivalent. Best, Ting Date: Tue, 19 Jul 2011 02:22:47 -0400 Subject: Re: [Haskell-cafe] question regarding the $ apply operator From: allber...@gmail.com To: tin...@hotmail.com CC: haskell-cafe@haskell.org On Tue, Jul 19, 2011 at 02:16, Ting Lei <tin...@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 allber...@gmail.com wandering unix systems administrator (available) (412) 475-9364 vm/sms
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe