[racket] syntax-e vs syntax->list

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 15 02:13:39 EDT 2014

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>)


Posted on the users mailing list.