8 Oct
2007
8 Oct
'07
2:45 a.m.
Brett Cannon wrote:
On 10/7/07, Adam Atlas
wrote: def dec(a, b, foo=bar)(func)(*a, **k): ...stuff... return func(*a, **k)
My argument against it is it's ugly and hard to notice.
I think it's rather elegant in its own way. There's something exactly analogous in Scheme, where you can write (define (f (g x)) ... ) and it gets macro-expanded into the corresponding nested sequence of lambdas. (The really elegant part about it in Scheme is that it's not a separate feature -- it just automatically falls out of the way define is defined in terms of lambda.)
I imagine each successive call would return an object something like a partial.
I would implement it by compiling it exactly as though it were written out as nested defs. -- Greg