Hello,

eq? decides object identity, or pointer equality. Symbols are interned,
which means that there's a table mapping symbol names to underlying
objects, such that using the name twice results in the same allocated
symbol object being returned.

Pairs are not interned. Each time a new pair is constructed, a new object
with its own identity comes into existence. Lists are built from pairs, so
these objects are separate.

I'm not sure why Guile returns #t for this. If pairs are mutable there,
then it could lead to aliasing problems. On the other hand, there's a long
tradition of being skeptical of using list structure that results from
quote when aliasing and identity matter, because quote returns its argument
directly and the reader can do unpredictable things in those contexts with
respect to identity. My guess is that Guile's reader is reusing list
structure, which you're observing.

David

On Fri, Oct 25, 2019, 07:35 wanderley.guimar...@gmail.com <
wanderley.guimar...@gmail.com> wrote:

> Why (eq? (quote a) (quote a)) is #t but (eq? (quote (a)) (quote (a)))
> is #f?  I would expect that if (quote (a)) was a mutable pair but it
> is not since (quote (a)) returns #f.  It seems that guile returns #t
> as I was expecting.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/CAAmHZof2uu7hkU4eMNz510UFOX4Pn5RUhj08_zHobqCcshdhug%40mail.gmail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CAF_itEvxaq6UUTunno6HJiBH%2Bwzn0hDrWoR7VxfV6r%3Dq%2BABF5Q%40mail.gmail.com.

Reply via email to