Re: Two questions about eq



On Mar 31, 8:49 am, Spiros Bousbouras <spi...@xxxxxxxxx> wrote:
1) The HS says that
(eq (cons 'a 'b) (cons 'a 'b))
always returns false but
(eq '(a . b) '(a . b))
might be true. Why is this ?

Because the compiler is allowed to select a canonical instance for
quoted constants (since you're not supposed to modify them). So, the
compiler could use the same cons for both occurrences of the quoted
dotted pair.

2) Under what (realistic) circumstances might
(eq 1 1) be false ?

Realistically, none, but use `eql' anyway.

-- Scott
.