dev-elider-3
Matthew Butterick 9 years ago
parent f3b176025e
commit 912010a172

@ -2,8 +2,8 @@
(require (for-syntax racket/base syntax/parse racket/syntax syntax/datum syntax/strip-context))
(provide (all-defined-out))
;; a little tricky because we have to mix two levels of macrology.
;; does not work with ellipses in the input pattern
(define-syntax (br:debug-define stx)
(syntax-parse stx
#:literals (syntax)
@ -25,6 +25,17 @@
(displayln (format "expanded syntax = #'~a" 'syntaxed-result))
syntaxed-result))))]))
(module+ test
(require rackunit racket/port)
(check-equal? (parameterize ([current-output-port (open-output-nowhere)])
(br:debug-define #'(foo <x> <y> <z>)
#'(apply + (list <x> <y> <z>)))
(foo 1 2 3)) 6))
;; does not work with ellipses in the input pattern
#;(br:debug-define #'(foo <x> ...)
#'(apply + (list <x> ...)))
(define-syntax (br:define stx)
(define-syntax-class syntaxed-id
#:literals (syntax)

Loading…
Cancel
Save