[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

tail recursion optimization

    Date: Tue, 3 Jun 1986  03:02 EDT
    From: Rob MacLachlan <glacier!RAM@C.CS.CMU.EDU>

    If this were a beauty contest then you would surely win, since Common
    Lisp doesn't currently have any way to talk about this sort
    of compile-time binding of global names.  I think that this
    deficiency should be remedied by adding a notion of block

Common Lisp certainly does have a way to talk about this sort of
thing.  My original question to the Common-Lisp mailing list
(2 years ago?), was something like
"Is (DEFUN foo (a...) body) equivalent to
	(SETF (SYMBOL-FUNCTION 'foo) #'(LAMBDA (a...) body))
	(SETF (SYMBOL-FUNCTION 'foo) (LABELS ((foo (a...) body)) #'foo))
LABELS also accomodates block compilation easily.  The only question
is whether it is used by DEFUN or not.  Various people objected to
this.  The only argument I can remember after this long a time (there
are archives of this stuff of course) is that TRACE wouldn't work on
functions that branched back because TRACE works by using the
SYMBOL-FUNCTION cell.  Of course, TRACE could be fixed instead of
breaking DEFUN, but that's not how things were left...

P.S. I think DEFUN ought to be defined in the manual by LISP code such
as the above to avoid ambiguity.  Implementations will of course add
cruft to remember old definitions and issue warnings and stuff, but
the basic operation should be well-defined in terms of simpler LISP