In article <·············@WINTERMUTE.eagle> SDS <···········@cctrading.com> writes:
From: SDS <···········@cctrading.com>
Newsgroups: comp.lang.lisp
Date: 08 Sep 1997 12:27:37 -0400
Organization: desorganization
Lines: 34
Sender: ···@WINTERMUTE
Return-Receipt-To: ···········@cctrading.com
X-Disclaimer: You should not expect anyone to agree with me.
X-No-Archive: Yes
Mail-Copies-To: ···········@cctrading.com
X-Newsreader: Gnus v5.3/Emacs 19.34
I would like to define local functions (that will be called many times)
in a way dependent on an argument passed to a funtion. To my surprise I
discovered in the process that #' and symbol-function are not the same
thing!
I did the following:
(flet ((zz (xx) (1+ xx)))
(when whatever
(setf (symbol-function 'zz) #'(lambda (xx) (1- xx)))))
...
[The whole point is NOT to check for whatever in the function, so
suggestions like
(flet ((zz(xx) (if whatever (1+ xx) (1- xx)))))
are unacceptable!]
(if whatever
(flet ((zz (1+ xx)))
... (zz ww))
(flet ((zz (1- xx)))
... (zz ww)))
If you answer that this is too much typing (i.e. the ... is really a
*lot* of code), then I would suggest that you break up your code into
smaller subfunctions.
Cheers
--
Marco Antoniotti
==============================================================================
California Path Program - UC Berkeley
Richmond Field Station
tel. +1 - 510 - 231 9472