[Haskell-beginners] Addable function combinators
edgar klerks
edgar.klerks at gmail.com
Sun Mar 28 20:04:54 EDT 2010
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20100328/47165260/attachment-0001.html
More information about the Beginners
mailing list