abuse of lambda question

Ben Wolfson rumjuggler at cryptarchy.org
Wed Jun 7 20:13:41 EDT 2000


On 07 Jun 2000 23:53:51 +0100, Michael Hudson <mwh21 at cam.ac.uk> wrote:

>You don't post the code for If, and I'm a bit confused, because in one
>place:
>
>> odds=odds, l=l,app=app: If(l.index(e)%2==0, app(evens,e), app(odds,e))
>
>you pass a value as the first parameter, and in another:
>
>> If(lambda c=c,fs=fs: c==len(fs)-1, Return(fs[-1]()), fs[c]))()
>
>you pass a thunk.  Which do you want?  I suspect this may be giving
>the error you're suffering, though I can't get it to work at all.

def If(cond, t, f):
	if callable(cond):
		cond = cond()
	if cond:
		return t()
	return f()


>Also:
>
>> a=a,e=e:a.append(e): Compose(apply(map, (lambda e, evens=evens,
>                               ^^^^^
>what's this apply for?

Good question.  Therein lie a lot of problems, I think.

-- 
Barnabas T. Rumjuggler

Ibi nullus timet mortem
Sed pro Baccho mittunt sortem
 -- Carmina Burana




More information about the Python-list mailing list