3
votes

Consider the following two pieces of Racket code:

;version A
(define-syntax (b stx) 
  (syntax-case stx () [(X u) #'(display  (syntax->datum #'(X u v)))]))
(b 1)

and

;version B
(define-for-syntax (g stx) 
  (syntax-case stx () [(X u) #'(display  (syntax->datum #'(X u v)))]))
(define-syntax (b s) (g s))
(b 1)

Experimentally, both programs return (b 1 v). Question: Is "version B" a valid Racket? If so, is it fully equivalent to "version A"?

1

1 Answers

3
votes

Yes, both of these are fine, and do exactly the same thing, as you've noticed.