functional programming and default parameters

Paul Foley see at below
Mon Jul 2 09:16:31 EDT 2001


On 02 Jul 2001 12:16:05 +0200, Ralf Muschall wrote:

> The situation in python is remotely similar to lisp in that the loop
> variable is created only once - just forcing python to create a fresh
> scope needs a more verbose hack.

> OTOH, 

> (#Mfuncall (#M(lambda (x) (lambda () x)) (scan-range :below 6)))

> works :-)

Assuming you have the SERIES package installed; but I think the fact
that it does is just an accident -- #M is only meant to work on named
functions.  [But (lambda (x) (lambda () x)) has a name in CL, anyway;
it's CONSTANTLY]

And you want a list, so

  (collect (#Mfuncall (#Mconstantly (scan-range :below 6))))

-- 
You have been evaluated.  You have a negative reference count.  Prepare
to be garbage collected.  Persistence is futile.           -- Erik Naggum

(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(#\@) "actrix.gen.nz>"))



More information about the Python-list mailing list