[Openmcl-devel] Eq definition

R. Matthew Emerson rme at clozure.com
Tue Mar 2 15:51:21 PST 2010


On Mar 2, 2010, at 5:12 PM, Mathieu Suen wrote:

> On Mar 2, 2010, at 10:40 PM, Gary Byers wrote:
>> 
>> On Tue, 2 Mar 2010, Mathieu Suen wrote:
>> 
>>> I read the source code of the eq function and find it quite odd:
>>> 
>>> (defun eq (x y)
>>> "Return T if OBJ1 and OBJ2 are the same object, otherwise NIL."
>>> (eq x y))
>>> ;; /level-0/l0-pred.lisp
>>> 
>>> Is it because it's a primitive?
>> 
>> Yes.
>> 
>> For extra credit: try to define EQ in lisp without depending on
>> the compiler to open-code EQ, e.g. :
>> 
>> (declaim (notinline eq))
>> 
>> (defun eq (x y)
>> ;;; ????
>> )
>> 
>> (This is a koan; if you think about it long enough, you'll either
>> achieve enlightenment or get a bad headache.)
>> 
> 
> :)
> I guess that code never get interpreted so what is the purpose of it?

EQ needs to be available as a real function too, in order to be able to FUNCALL or APPLY it.





More information about the Openmcl-devel mailing list