[racket] Syntax-e & syntax->list

From: Carl Eastlund (cce at ccs.neu.edu)
Date: Mon Sep 9 15:57:28 EDT 2013

If you have syntax that prints as #'(1 2), the result of syntax-e might be
several things:

(list #'1 #'2)
(cons #'1 (cons #'2 #'()))
(cons #'1 #'(2))

There's no guarantee how far the conses go down the spine before you hit
another syntax object, it depends on how the syntax was constructed.  The
syntax->list function, however, guarantees you won't hit a syntax object
somewhere along the way.

Carl Eastlund


On Mon, Sep 9, 2013 at 3:53 PM, Roman Klochkov <kalimehtar at mail.ru> wrote:

>  In help about syntax->list:  In other words,  syntax pairs  in  (
> syntax-e   stx )  are flattened.
>
> Tests:
> > (syntax->list #'((1 2)))
> '(#<syntax:22:19 (1 2)>)
> > (syntax-e #'((1 2)))
> '(#<syntax:24:15 (1 2)>)
>
> Result is the same. No flattening. Or I missed something?
>
> --
> Roman Klochkov
>
> P.S. Racket 5.3.6, Linux
>
> ____________________
>   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/20130909/6eefb172/attachment.html>

Posted on the users mailing list.