[Types-sig] types, functional stuff.
John Skaller
skaller@maxtal.com.au
Sat, 05 Dec 1998 00:45:00 +1000
>Now, John Skaller asked for:
>
>> compose(f1, f2, f3, f4 ..) # chain in series, 1 arg only
>> product(f1, f2, f3, f4, ..) # apply componentwise (in parallel)
>> sum(f1, f2, .. ) # select one of
>> delta(x,i) = (x,x,x,x,x ..) # i times
>
>so, John: there follow implementations for 3 of these in python
I already have working implementation in interscript's felix
package.
> The language doesn't need them as built-ins.
Yes it does. Your implementation is the same as mine,
and it doesn't work for the same reason: we both use delagation.
This binds the result to the _current_ definition of a function,
not the definition at the point of call.
For actual functions, this is no problem. They're
immutable. But the compose object is not. It's a class instance
whose definition can be changed by changing the args list.
-------------------------------------------------------
John Skaller email: skaller@maxtal.com.au
http://www.maxtal.com.au/~skaller
phone: 61-2-96600850
snail: 10/1 Toxteth Rd, Glebe NSW 2037, Australia