> On May 7, 2016, at 12:57 AM, Alexis King <[email protected]> wrote: > > Is there any way to create a new syntax object containing a list without > recursively converting the list’s elements to syntax objects as well? I > have some code where I wanted to use syntax objects as a convenient > mechanism to tag arbitrary datums with source location information (and > they will be used as syntax objects later), but that code expects > datum->syntax followed by syntax-e to return the original datum, which > obviously isn’t the case if datum->syntax recursively wraps datums as > well. > > Is there any way to construct a new syntax object without this recursive > behavior?
I'm not sure if this helps you, but if you have complete control over what happens to it, you could wrap it in a struct first: (struct my-struct (lst)) (define (wrap lst #:ctxt ctxt) (datum->syntax ctxt (my-struct lst))) (define (unwrap stx) (my-struct-lst (syntax-e stx))) (define the-list (list 'a 'b 'c)) (define the-syntax (wrap the-list #:ctxt #f)) (check-eq? (unwrap the-syntax) the-list) Does that work with what you want to do? Alex Knauth -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.

