
12 Feb
2013
12 Feb
'13
11 p.m.
A less obvious interpretation is to treat ($) as `id'. (f . g) x = f $ g x = f (id g x) = f (g x) Bah, we can even illustrate that ($) is simply an infix identity function: Prelude> map ((flip id) 2) [\x -> x - 3] [-1] Prelude> map (`id` 2) [\x -> x - 3] [-1] Prelude> map ($ 2) [\x -> x - 3] [-1] I just wanted to throw this out there as I found this out recently myself and found it fairly useful. I believe someone else already posted a link about pointless style. On 12/02/13 21:09, Martin Drautzburg wrote:
On Friday, 1. February 2013 23:02:39 Ertugrul Söylemez wrote:
(f . g) x = f (g x)
so (f . g) x = f $ g x
right?
That looks like the two are pretty interchangeable. When would I prefer one over the other?