[racket] syntax-e vs syntax->list
Thank you!
I thought, that #'(1 . (2)) == #'(1 2) as '(1 . (2)) == '(1 2)
And Racket printer thinks same:
> #'(1 . (2))
#<syntax:19:4 (1 2)>
Fri, 15 Aug 2014 07:13:39 +0100 от Matthew Flatt <mflatt at cs.utah.edu>:
>At Fri, 15 Aug 2014 09:55:11 +0400, Roman Klochkov wrote:
>> What is the difference?
>>
>> > (let ([stx #'(1 (+ 3 4) 5 6)]) (equal? (syntax->list stx) (syntax-e stx)))
>> #t Or syntax->list == (lambda (x) (let ([res (syntax-e x)]) (if (list? x) x
>> #f))) ?
>
>You need a `.` to expose the difference:
>
> > (syntax-e #'(1 . (2)))
> '(#<syntax::35 1> . #<syntax::39 (2)>)
>
> > (syntax->list #'(1 . (2)))
> '(#<syntax::62 1> #<syntax::67 2>)
>
--
Roman Klochkov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140815/46bbc2ef/attachment.html>