Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Philip McGrath
On Fri, Oct 25, 2019 at 1:27 PM wanderley.guimar...@gmail.com < wanderley.guimar...@gmail.com> wrote: > On Fri, Oct 25, 2019 at 9:28 AM Alexis King wrote: > >> Unlike eq? on symbols, eq?’s behavior on quoted lists is unspecified … >> Is there a reason you would like the answer to be #t? > > Not s

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread wanderley.guimar...@gmail.com
On Fri, Oct 25, 2019 at 9:28 AM Alexis King wrote: > Unlike eq? on symbols, eq?’s behavior on quoted lists is unspecified, so I > do not think there is a significantly deeper reason than “that isn’t what > the current implementation chooses to do.” Whether the answer is #t or #f > could change to

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Jens Axel Søgaard
Den fre. 25. okt. 2019 kl. 16.35 skrev wanderley.guimar...@gmail.com < wanderley.guimar...@gmail.com>: > 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 tha

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Alexis King
> On Oct 25, 2019, at 11:34, David Thrane Christiansen > wrote: > > I'm not sure why Guile returns #t for this. If pairs are mutable there, then > it could lead to aliasing problems. The Scheme standard has historically left the behavior of mutation on quoted values unspecified to permit prec

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread David Thrane Christiansen
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 co

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Sage Gerard
Typo: Meant (let ([l (quote (a))]) (eq? l l)) ~slg ‐‐‐ Original Message ‐‐‐ On Friday, October 25, 2019 12:28 PM, Sage Gerard wrote: > By https://docs.racket-lang.org/reference/symbols.html, Two interned symbols > are eq? to each other. > > But in the other example, you are comparing

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Alexis King
Unlike eq? on symbols, eq?’s behavior on quoted lists is unspecified, so I do not think there is a significantly deeper reason than “that isn’t what the current implementation chooses to do.” Whether the answer is #t or #f could change tomorrow, on a different VM, on a different architecture, or

Re: [racket-users] eq? of quoted expressions

2019-10-25 Thread Sage Gerard
By https://docs.racket-lang.org/reference/symbols.html, Two interned symbols are eq? to each other. But in the other example, you are comparing two lists each containing a single symbol. A new list is created in each expression, and eq? is comparing the object references and not the content. Fo

[racket-users] eq? of quoted expressions

2019-10-25 Thread wanderley.guimar...@gmail.com
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