[racket] how does equal? determine with syntax objects?
http://www.htdp.org/2003-09-26/Book/curriculum-Z-H-52.html#node_chap_42
(intensional ~ eq?, extensional ~ equal?)
On Aug 7, 2014, at 9:44 PM, Alexander D. Knauth wrote:
>
> On Aug 7, 2014, at 8:53 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
>>
>> Here are some examples:
>>
>>>> (equal? #'(lambda (x) x) #'(lambda (x) x))
>>> #f
>
> For these the source locations would still be different.
>
>>>> (define so #'(lambda (x) x))
>>>> (equal? so so)
>>> #t
>
> For these they are eq?.
>
>
>
> Does equal? simply use eq? for syntax objects?
> This example says probably, or am I still missing something?
> (define stx #'(lambda (x) x))
> (equal? stx (datum->syntax stx (syntax-e stx) stx stx stx))
>
>> Are syntax objects mutable? If so, how would you define a function like eq? say syntax-eq? without using the built-in equality?
>>
>> Are syntax objects immutable? Why should they be immutable? How does equal? work on such structures normally?
>
> I was under the impression that syntax objects were immutable, but I don’t really know.
> And anyway, for mutable vectors, strings, byte-strings, and structs, equal? still checks each element.
>
>> See HtDP on extensional and intensional equality. — Matthias
>
> Where? I have read a lot of HtDP, and looked at it again just now, but I don’t remember anything about this, and couldn’t find anything either.
> In the BSL docs for eq? and eqv? it mentions extensional and intensional, but doesn’t explain anything.
> In Realm of Racket there was a bit about that, but that doesn’t really tell me anything about syntax objects.
>
>>
>> On Aug 7, 2014, at 5:58 PM, Alexander D. Knauth wrote:
>>
>>> How does equal? determine whether two syntax objects are equal?
>>>
>>> Does it simply use eq?, or does it check the syntax-e, lexical context, srcloc and properties?
>>>
>>>
>>>
>>> ____________________
>>> Racket Users list:
>>> http://lists.racket-lang.org/users
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140807/bd01177c/attachment.html>