[Haskell-beginners] The application of application

Christopher Howard christopher.howard at frigidcode.com
Sat Dec 1 23:31:03 CET 2012


Can application of an expression (to a function) be treated like a
function itself? In my specific case, I started with this expression:

code:
--------
(cos b * velocityC, sin b * velocityC)
--------

But I have a compulsive hatred of duplication. I happened to have this
function handy called appPair:

code:
-------
appPair f (a, b) = (f a, f b)

appPair (* velocityC) (cos b, sin b)
-------

Better, but the b identifier is still duplicated. Is there some way I
could have...

code:
--------
appPair (?) (cos, sin)
--------

...shifting the application of b into the (* velocityC) expression,
without modifying my appPair function?

-- 
frigidcode.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 551 bytes
Desc: OpenPGP digital signature
URL: <http://www.haskell.org/pipermail/beginners/attachments/20121201/9c5bbff9/attachment.pgp>


More information about the Beginners mailing list