[plt-scheme] Borrowing #' aka quote-syntax

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sat Dec 9 08:55:01 EST 2006

On Sat, 2006-12-09 at 00:03 +0100, Jens Axel Søgaard wrote:

> Today I wanted to borror #' for my own purpose, so I tried
> the same trick:
> 
>  > (let-syntax ([quote-syntax
>                  (lambda (stx)
>                    (display "foo\n")
>                    (syntax-case stx ()
>                      [(_ datum) #'42]))])
>      (list #'abc #'(1 2 3)))
> (.#<syntax:22:12> .#<syntax:22:18>)
> 
> The first syntax-object contains abc and the other (1 2 3).

#' is an abbreviation for syntax, not quote-syntax.

(let-syntax ([syntax
                 (lambda (stx)
                   (display "foo\n")
                   (syntax-case stx ()
                     [(_ datum) (syntax 42)]))])
     (list #'abc #'(1 2 3)))
foo
foo
(42 42)

sam th



Posted on the users mailing list.