Subject: Re: Common Lisp flet
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 24 Sep 2005 05:49:25 -0500
Newsgroups: comp.lang.lisp
Message-ID: <x8adnakIx9uosqjeRVn-ug@speakeasy.net>
Matthew D Swank  <akopa-is-very-much-like-my-mail-address@c.net> wrote:
+---------------
| Are local (lexically scoped) function values not setf-able?
+---------------

No, they're not. The bindings created by FLET & LABELS sre not mutable.

However, depending on what you're *really* trying to do,
you can either:

1. Nest (shadow) lexical functions:

     > (flet ((foo () 3))
	 (flet ((foo () 7))
	   (foo)))

     7
     > 

2. Store the functions in mutable variables, and use FUNCALL on them:

    > (let ((foo (lambda () 3)))
	(print (funcall foo))
	(setf foo (lambda () 7))
	(print (funcall foo))
	(values))

     3
     7
     > 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607