Re: Lambda as declarative idiom
From: Robert Brewer (fumanchu_at_amor.org)
Date: 01/04/05
- Next message: sigzero_at_gmail.com: "Re: cxOracle for python 2.4"
- Previous message: Anders J. Munch: "Re: Speed ain't bad"
- Next in thread: Jeff Shannon: "Re: Lambda as declarative idiom"
- Reply: Jeff Shannon: "Re: Lambda as declarative idiom"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 4 Jan 2005 14:31:17 -0800 To: "Michael Spencer" <mahs@telcopartners.com>, <python-list@python.org>
Michael Spencer wrote:
> Roman Suzi wrote:
>
> > Maybe this is too outlandish, but I see lambdas as a
> "quote" mechanism,
> > which presents a possibility to postpone (precisely
> control, delegate)
> > evaluation. That is, an ovehead for lambda must be much
> lower but at the
> > same time visible to the programmer:
> >
> > d = a + (lambda x, y: x+ y)(3, 4)
> [...]
>
> 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)
Robert Brewer
MIS
Amor Ministries
fumanchu@amor.org
- Next message: sigzero_at_gmail.com: "Re: cxOracle for python 2.4"
- Previous message: Anders J. Munch: "Re: Speed ain't bad"
- Next in thread: Jeff Shannon: "Re: Lambda as declarative idiom"
- Reply: Jeff Shannon: "Re: Lambda as declarative idiom"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|