Addable function combinators

He All, I was toying a bit around and found a function, which combines an function of arity 1 with 2. Then I produced a whole sequence of these function, the number of * stands for the arity of the left function and the number of | stands for arity the right function. so <*|||> :: (b -> c -> d) -> (a -> c) -> a -> b -> d: (<*****|>) = flip (<*|||||>) (<****|>) = flip (<*||||>) (<***|>) = flip (<*|||>) (<**|>) = flip (<*||>) (<*|>) = (.) (<*||>) = (<*|>).(<*|>) (<*|||>) =(<*||>).(<*|>) (<*||||>) = (<*||>).(<*||>) (<*|||||>) = (<*||||>).(<*|>) con = (flip.) .(.) (<**||>) = (<*||>).flip (<**|||>) = (<*|>).(<**||>) (<**||||>) = (<*|>).(<**|||>) (<***||>) = (<*||>).(con flip) (<***|||>) = (<*|>).(<***||>) (<****||>) = (<*||>).(con.con $ flip) I found it interesting, but now I am stuck. is it possible to make the stars addable instead of the | or both? Greets, Edgar Edgar

A small erratum <*|||> has type (b -> c) (a -> a1 -> a2 -> b) a a1 a3 and it
is nicer to add more * by defining these functions:
con = (flip.) .(.)
(<**>) = flip
(<***>) = con (<**>)
(<****>) = con (<***>)
(<*****>) = con (<****>)
Then the serie of <**|> gets:
(<*****|>) = (<*|>).(<*****>)
(<****|>) = (<*|>).(<****>)
(<***|>) = (<*|>).(<***>)
(<**|>) = (<*|>).(<**>)
(<*|>) = (.)
Now they behave more like (.), Eg: <**|> :: (a -> b -> c) (a1 -> b) -> a1 ->
a -> c
And the rest becomes:
(<**||>) = (<*||>).(<**>)
(<**|||>) = (<*|>).(<**||>)
(<**||||>) = (<*|>).(<**|||>)
(<***||>) = (<*||>).(<***>)
(<***|||>) = (<*|>).(<***||>)
On Mon, Mar 29, 2010 at 2:04 AM, edgar klerks
He All,
I was toying a bit around and found a function, which combines an function of arity 1 with 2. Then I produced a whole sequence of these function, the number of * stands for the arity of the left function and the number of | stands for arity the right function. so <*|||> :: (b -> c -> d) -> (a -> c) -> a -> b -> d:
(<*****|>) = flip (<*|||||>) (<****|>) = flip (<*||||>) (<***|>) = flip (<*|||>) (<**|>) = flip (<*||>) (<*|>) = (.) (<*||>) = (<*|>).(<*|>) (<*|||>) =(<*||>).(<*|>) (<*||||>) = (<*||>).(<*||>) (<*|||||>) = (<*||||>).(<*|>)
con = (flip.) .(.) (<**||>) = (<*||>).flip (<**|||>) = (<*|>).(<**||>) (<**||||>) = (<*|>).(<**|||>) (<***||>) = (<*||>).(con flip) (<***|||>) = (<*|>).(<***||>) (<****||>) = (<*||>).(con.con $ flip)
I found it interesting, but now I am stuck. is it possible to make the stars addable instead of the | or both?
Greets,
Edgar Edgar
-- Flatliner ICT Service, Email: Edgar.klerks@gmail.com, Tel: +31727851429 Fax: +31848363080 Skype: edgar.klerks Website: flatlinerict.nl Adres: Koelmalaan 258, 1813JD, Alkmaar Nederland

Hi Edgar, I am not sure what you are asking. What do you mean "to make the stars addable"? -Brent On Mon, Mar 29, 2010 at 02:04:54AM +0200, edgar klerks wrote:
He All,
I was toying a bit around and found a function, which combines an function of arity 1 with 2. Then I produced a whole sequence of these function, the number of * stands for the arity of the left function and the number of | stands for arity the right function. so <*|||> :: (b -> c -> d) -> (a -> c) -> a -> b -> d:
(<*****|>) = flip (<*|||||>) (<****|>) = flip (<*||||>) (<***|>) = flip (<*|||>) (<**|>) = flip (<*||>) (<*|>) = (.) (<*||>) = (<*|>).(<*|>) (<*|||>) =(<*||>).(<*|>) (<*||||>) = (<*||>).(<*||>) (<*|||||>) = (<*||||>).(<*|>)
con = (flip.) .(.) (<**||>) = (<*||>).flip (<**|||>) = (<*|>).(<**||>) (<**||||>) = (<*|>).(<**|||>) (<***||>) = (<*||>).(con flip) (<***|||>) = (<*|>).(<***||>) (<****||>) = (<*||>).(con.con $ flip)
I found it interesting, but now I am stuck. is it possible to make the stars addable instead of the | or both?
Greets,
Edgar Edgar
_______________________________________________ Beginners mailing list Beginners@haskell.org http://www.haskell.org/mailman/listinfo/beginners
participants (2)
-
Brent Yorgey
-
edgar klerks