Subject: Re: Lisp with XML concrete syntax
From: Erik Naggum <erik@naggum.net>
Date: 2000/11/28
Newsgroups: comp.lang.lisp
Message-ID: <3184424063976812@naggum.net>
* Hannah Schroeter
| And why not
|
| (defun factorial (x &optional (ac 1))
| (if (<= x 1)
| ac
| (factorial (1- x) (* ac x))))
There are many good reasons not to do tail-call merging for calls to
global, user-defined functions. The function is conceptually distinct
from the name, and while few people do it, you could copy the function
over to a different symbol, and do something else with the old symbol.
You _should_ expect to see it call the function in the old symbol, as
that is the defined semantics of Common Lisp function calls. It also
helps debugging and numerous other common tasks not to confuse symbol
with function named by symbol.
Local functions have no such restrictions, of course, being part of
the function itself rather than depend on the symbol for its meaning.
I consider the above code fragment tantamount to using dynamic binding
simply out of tradition. The optional argument is another sign of old
design and should be considered abuse of a language feature today.
#:Erik
--
Solution to U.S. Presidential Election Crisis 2000:
Let Texas secede from the Union and elect George W. Bush their
very first President. All parties, states would rejoice.