Thursday, June 10, 2004

My fun with eq?

In scheme eq? compares for equality in the sense of if both args point to the same object, then #t. In Python the number 1 is an object. There is one such object. If x and y both = 1, then both x and y point to the same object.

Scheme R5RS does not require that numbers be implemented this way and thus (eq? 1 1) can return false in one implementation (e.g. SISC) and true in another (e.g. MZScheme).

Thanks to Matthias Radestock for pointing this out.


No comments: