Re: Function composition and currying

2003-07-25 Thread Dr Mark H Phillips
Thanks to all the people who responded to my question! The solution from Wolfgang Jeltsch: (f.).g was what I was after. But the other responses were useful also. Thanks! Mark. On Thu, 2003-07-17 at 09:57, Dr Mark H Phillips wrote: > Hi, > > Hopefully this is a simple question. I am wanti

Re: User-Defined Operators, Re: Function composition and currying

2003-07-19 Thread Andrew J Bromage
G'day all. On Sat, Jul 19, 2003 at 01:52:32AM -0400, Dylan Thurston wrote: > It's maybe easiest to think in terms of group theory with an > action on a set: you're just distinguishing between the multiplication > of group elements and the actual action. This distinction is not > usually reflecte

Re: User-Defined Operators, Re: Function composition and currying

2003-07-19 Thread Wolfgang Jeltsch
On Saturday, 2003-07-19, 07:52, CEST, Dylan Thurston wrote: > [...] > But if you have -Point, then you have a 0 Point, and there's no distinction > between Points and Vectors at all! Yes, I always thought (and still think) that the (main) difference between points in affine geometry and radius v

Re: User-Defined Operators, Re: Function composition and currying

2003-07-18 Thread Dylan Thurston
On Sat, Jul 19, 2003 at 02:06:44PM +1000, Andrew J Bromage wrote: > G'day all. > > On Fri, Jul 18, 2003 at 04:08:25AM -0400, Dylan Thurston wrote: > > > What's wrong with that solution? > > Working with these operators, I would spend a significant amount of > time getting the '<' and '>' notatio

Re: User-Defined Operators, Re: Function composition and currying

2003-07-18 Thread Andrew J Bromage
G'day all. On Fri, Jul 18, 2003 at 04:08:25AM -0400, Dylan Thurston wrote: > What's wrong with that solution? Working with these operators, I would spend a significant amount of time getting the '<' and '>' notations right rather than writing code. I don't like that. For example, using the sug

Re: Function composition and currying

2003-07-18 Thread Stefan Karrmann
K. Fritz Ruehr (Wed, Jul 16, 2003 at 11:19:55PM -0700): c0 = ($) -- application > c1 = (.) -- good old composition > > c2 = (.) . (.)-- my (.<) from above > > c3 = (.) . (.) . (.) > > c4 = (.) . (.) . (.) . (.) > >

Re: User-Defined Operators, Re: Function composition and currying

2003-07-18 Thread Dylan Thurston
On Fri, Jul 18, 2003 at 11:39:48AM +1000, Andrew J Bromage wrote: > > Someone mentioned multiplying by a scalar. I think this is a > > good application, but what we need is to agree (somehow) on > > the symbol used. I've used (*.) and (.*), with the dot being > > on the side the scalar is on (on th

Re: User-Defined Operators, Re: Function composition and currying

2003-07-17 Thread Andrew J Bromage
G'day all. On Thu, Jul 17, 2003 at 04:46:13PM +0100, Jon Fairbairn wrote: > Someone mentioned multiplying by a scalar. I think this is a > good application, but what we need is to agree (somehow) on > the symbol used. I've used (*.) and (.*), with the dot being > on the side the scalar is on (on

Re: Function composition and currying

2003-07-17 Thread oleg
What I nice application for a multi-variadic compositional operator mcomp [1]. Only one operator does the trick, for functions of arbitrary number of curried arguments. And I really mean the arbitrary number of arguments, in both functions under composition. Given > f1 x = x*x > g2 a b = a + b >

Re: Function composition and currying

2003-07-17 Thread Dean Herington
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 u

Re: User-Defined Operators, Re: Function composition and currying

2003-07-17 Thread Jon Fairbairn
On 2003-07-17 at 09:08+0200 Johannes Waldmann wrote: > On Wed, 16 Jul 2003, K. Fritz Ruehr wrote: > > > I think the cutest way to get what you want here is to define a new > ^^ > > operator as follows: > > > > (.<) = (.) . (.) > > Indeed this is cute - but let me add a gene

Re: Function composition and currying

2003-07-17 Thread Brett A. Letner
How about... h a = f . g a or... f $ g 1 2 f :: Int -> Int f x = x*x g :: Int -> Int -> Int g a b = a + b ... But what I really want is a function with signature Int -> Int -> Int. -- Brett Letner Galois Connections, Inc. http://www.galois.com mailto:[EMAIL PROTECTED] phone:(503)626-6616

User-Defined Operators, Re: Function composition and currying

2003-07-17 Thread Johannes Waldmann
On Wed, 16 Jul 2003, K. Fritz Ruehr wrote: > I think the cutest way to get what you want here is to define a new ^^ > operator as follows: > > (.<) = (.) . (.) Indeed this is cute - but let me add a general comment here: in my code, I don't define any operators at all (only

Re: Function composition and currying

2003-07-17 Thread Tom Pledger
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 "

Re: Function composition and currying

2003-07-16 Thread K. Fritz Ruehr
I think the cutest way to get what you want here is to define a new operator as follows: (.<) = (.) . (.) (the choice of symbol is supposed to suggest this new form of composition with "two prongs" on the right). Then you can use it as follows, for example: f x = x * x g a b = a + b

Re: Function composition and currying

2003-07-16 Thread Wolfgang Jeltsch
Hi, you may use (f .) . g. Wolfgang On Thursday, 2003-07-17, 02:27, CEST, Dr Mark H Phillips wrote: > Hi, > > Hopefully this is a simple question. I am wanting to know good ways > of using ".", the function composition operator, when dealing with > currying functions. > > Suppose I have the fo

Function composition and currying

2003-07-16 Thread Dr Mark H Phillips
Hi, Hopefully this is a simple question. I am wanting to know good ways of using ".", the function composition operator, when dealing with currying functions. Suppose I have the following functions defined: f :: Int -> Int f x = x*x g :: Int -> Int -> Int g a b = a + b If I wish to ad