Fun with lambda and map

ivo at ivo at
Mon Feb 4 17:38:07 CET 2002

Jason Orendorff <jason at> wrote:
: Ivo wrote:
:> I implemented some of the pure (?) lambda calculus in python:
:> Who needs '+' , 'if' and numbers? :)

: Wow.  It's extra cool that this should come up, because I just
: recently tore through the first chapter of SICP, and wrote this:


I extended the calculus a bit with mul (based on your sig :) and pred, 
hoping that I could fac in lambda, but I guess I've reached pythons lambda 

The statement:

fac = lambda q: if_then_else(is_zero(pred(q)))(n1)(mul(q, fac(pred(q))))

(check for the other definitions)

will recurse endlessly, because the else-part will always be evaluated
(but just not used as a result).

(why I do all this? Just pure academic interest - lambda calculus
used to fascinate me at the university)


Drs. I.R. van der Wijk                              -=-
Brouwersgracht 132                      Amaze Internet Services V.O.F.
1013 HA Amsterdam                                   -=-
Tel: +31-20-4688336                          Linux/Web/Zope/SQL
Fax: +31-20-4688337                           Network Solutions
Web:                    Consultancy
Email:   ivo at                         -=-

More information about the Python-list mailing list