I've cut and pasted together what seems
to be the concensus answer:
> MAX is predefined in Common Lisp.
> MAX is a builtin function.
> ...you are redefining the Common Lisp function CL:MAX.
> .. by redefining it, you are probably breaking a compiler
> .. invariant somewhere. �Bad things happen if you do that :-)
> your problem comes from redefining a standard Common Lisp function.
There were also a couple of suggestions to place max
in a different namespace or give it another name, and
of course I could do that. The students also suggested
the aforementioned namespace collision with a builtin.
My response way "bah" -- Lisp allows you to redefine
functions -- even the builtin ones (although this is
not generally a good idea). To be a language lawyer,
here is a quote from Steel's "Common Lisp," sec 5.3.1, p.85.
"It is permissible to use defun to redefine a function,
to install a corrected version of an incorrect definition,
for example. It is permissible to redfine a macro as
a function."
If one could not redefine the builtin functions then
one would have to keep mental track of the very large
set of functions, macros, etc... that are predefined
in Lisp.
Also, even if one could not redefine the builtin
functions, the problem should manifest itself
at definition time:
* (defun max (a b) (if (> a b) a b))
MAX
* #'max
#<Interpreted Function MAX {4801E451}>
Everythings seems fine at this point. Shouldn't
I have at least been issued a warning of some sort?!?
> You created an infinite regress.
Assuming what I did was wrong, I am a little bit curious
as to how this manifested itself. I have a hard time
seeing how this could have triggered an "infinite regress."
Either my max or the system's max should have been invoked.
Can anyone explain how the system could have been
confused into issuing multiple recursive calls?
In any case, I wouldn't call this a "feature."
Any more thoughts? Thanks for your time.
--w
Wayne O. Cochran
Assistant Professor of Computer Science
Washington State University Vancouver
[EMAIL PROTECTED]
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/