[Haskell-cafe] Re: [Haskell] (.) . (.)

Fritz Ruehr fruehr at willamette.edu
Mon May 29 15:22:22 EDT 2006


On May 29, 2006, at 9:33 AM, Dominic Steinitz wrote:

>> Hi Dominic -
>> I hope it's ok for me to ask this question and I'm absolutely burning 
>> with curiosity to find out the answer...
>> How did you know to write ((.).(.)) instead of (\f g a b -> f (g a 
>> b)) ?
>
> Brian,
>
> I can't remember. I certainly don't find it intuitive. I think it was 
> discussed on the Haskell mailing list a long time ago.

It may have been this thread, where Tom Pledger points out that ($) 
makes a good "0-ary" case of the progression:

	<http://www.haskell.org/pipermail/haskell/2003-July/012259.html>

But then it's only 3 years old, so clearly not a "long time ago" :) .

   --  Fritz

PS: In my original posting on that thread, I said that abstracting this 
out as a fold of compositions over lists of compositions (foldr (.) id 
(replicate n (.)) was quite difficult for typing reasons. I now realize 
that Oleg probably does that sort of thing idly doodling on the back of 
a napkin while he chats on the phone with his other hand. My mistake. 
:)

----------

 From the thread (quoting Tom Pledger quoting me):

Tom Pledger wrote:

> K. Fritz Ruehr writes:
>  :
>  | But Jerzy Karczmarczuk enlightened me as to the full generality 
> possible
>  | along these lines (revealing the whole truth under the influence of 
> at
>  | least one beer, as I recall). Namely, one can define a sequence of
>  | functions (let's use a better notation now, with "c" for 
> composition):
>  |
>  |     c1 = (.)                      -- good old composition
>  |
>  |     c2 = (.) . (.)                -- my (.<) from above
>  |
>  |     c3 = (.) . (.) . (.)
>  |
>  |     c4 = (.) . (.) . (.) . (.)
>  |
>  |     -- etc.
>
> Nice!
>
> There's also
>
>     c0 = ($)
>
> which is clearer if you use 'non-pointfree' notation
>
>     ...
>     c2 f g x y = f (g x y)
>     c1 f g x   = f (g x)
>     c0 f g     = f  g
>
> - Tom

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 1960 bytes
Desc: not available
Url : http://www.haskell.org//pipermail/haskell-cafe/attachments/20060529/46ccf4d4/attachment.bin


More information about the Haskell-Cafe mailing list