Function composition
William Tanksley
wtanksle at dolphin.openprojects.net
Wed Aug 2 20:16:20 EDT 2000
On 2 Aug 2000 23:40:18 +0200, Cees de Groot wrote:
>I was showing a Math PhD/Functional programming guy Python, and of course he
>was interested in map, filter, etcetera. He talked about function composition,
>and I did a quick:
>def compose(f, g): return lambda x: f(g(x))
>but that's of course only for single-argument functions. My
Yup, that's pretty fundamental to the nature of lambda calculus.
If you want a way around that, you have to either require that all
functions take only one argument (which may be a tuple), or you can use a
concatenative language (in which the composition of f with g is written as
"g f" and functions can return multiple values).
The only concatenative language in major use is Postscript; Forth also
sees some use.
We've discussed this a little in this NG, and I started an egroups for
discussing it more. Some interesting results. It's very technical,
though; if you'd like to check it out it's at:
http://www.egroups.com/group/concatenative
>Cees
--
-William "Billy" Tanksley
More information about the Python-list
mailing list