PasteRack.org
Paste # 55366
2018-06-14 16:41:22

Fork as a new paste.

Paste viewed 134 times.


Embed:

  1. #lang racket
  2. (require (for-syntax syntax/to-string))
  3.  
  4. (define-syntax (display-self stx)
  5.   (syntax-case stx ()
  6.     [(_ exprs ...)
  7.      (with-syntax ([stx-source (format "(~a)" (syntax->string stx))])
  8.        #'(display stx-source))]))
  9.  
  10. (define-syntax (foo stx)
  11.   (syntax-case stx ()
  12.     [(_ arg) #'(display-self 'arg)]))
  13.  
  14. (foo x)

=>

(display-self'

x)