An example that helped me understand the utility of the $ operator is as follows: suppose that we have a list of functions
fs :: [a -> b]
fs = [f1, f2, ..., fk]
and a list of arguments
as :: [a]
as = [a1, a2, ..., ak]
and we want to produce the list
[f1(a1), f2(a2), ..., fk(ak)], or equivalently [f1 a1, f2 a2, ..., fk ak],
this can be done using the $ operator via
zipWith ($) fs as
simply because it makes the function application explicit.
::paul
On 2013-02-12, at 13:44 , mukesh tiwari wrote:
You can write (f . g) x as f . g $ x so for me, it's avoiding extra parenthesis.
Mukesh
_______________________________________________
Beginners mailing list
Beginners@haskell.org
http://www.haskell.org/mailman/listinfo/beginners