Re: Lambda as declarative idiom

From: Robert Brewer (fumanchu_at_amor.org)
Date: 01/04/05


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



Relevant Pages

  • Re: nested backquoting (newbie) question in Clisp
    ... (defmacro nth-expr (n &body exprs) ... The problem is not that insufficient evaluation is applied, ... compiling your construct to ELT, ... So here we are exploiting the lexical closure's ability to control ...
    (comp.lang.lisp)
  • Re: I/O in PURE and ELEMENTAL procedures in Fortran 2008
    ... That would violate what little clear semantics the language ... evaluated prior to the procedure evaluation. ... should be under the control of the user. ... no deficiencies and the other way is to make it so complicated ...
    (comp.lang.fortran)
  • Re: setting permissions / trusting company via certificate?
    ... The permission grant ... is evaluated before the control assembly is actually loaded, ... evaluation. ... also be used if you would prefer to stick with signature evidence for your ...
    (microsoft.public.dotnet.security)
  • Re: Pure Curiousity
    ... What special forms can do is to control the evaluation of its arguments. ... This is handled by compile-time processing of those special forms. ... In the context of Lisp, reflection is one of the most thoroughly researched approaches. ...
    (comp.lang.lisp)