Lambda as declarative idiom
Jeff Shannon
jeff at ccvcorp.com
Tue Jan 4 19:10:22 EST 2005
Robert Brewer wrote:
> Michael Spencer wrote:
>
>>I believe that this "possibility to postpone" divides into
>>two related but separate concepts: controlling the moment
>>of evaluation, and assembling the arguments required at
>>that moment. They are both species of 'eval', but
>>managing arguments is more specialized, because it includes
>>possibly renaming parameters, assigning default values,
>>processing positional and keyword arguments, and, perhaps
>>in the future dealing with argument types.
>
> Yes, but the "moment of evaluation" is more complex than just
> "postponing". In a declarative construct, you probably also want global
> variables to be bound early, so that the expression does not depend upon
> *any* free variables. Ditto for closures. A more realistic example:
>
> term = input("Enter the amount to add")
> e = expr(x): x + term
>
> ...MUCH code passes, maybe even a new process or thread...
>
> d = a + e(3)
I see this as simply a combination of both of the aforementioned
concepts -- argument control plus moment-of-evaluation control.
Jeff Shannon
Technician/Programmer
Credit International
More information about the Python-list
mailing list