How to create a macro that generates another macro in SISC / Scheme? -
in guile or using srfi-46 possible shown in specifying custom ellipsis identifier. possible in sisc or "pure scheme" r5rs?
i know possible without using ellipsis, if need use inner ellipsis example bellow?
(define-syntax define-quotation-macros (syntax-rules () ((_ (macro-name head-symbol) ...) (begin (define-syntax macro-name (syntax-rules ::: () ((_ x :::) (quote (head-symbol x :::))))) ...)))) (define-quotation-macros (quote-a a) (quote-b b) (quote-c c)) (quote-a 1 2 3) ⇒ (a 1 2 3)
the macro expander used in sisc, psyntax, supports different way inner ellipses, using ...
macro. can write applying ...
macro each inner ellipses want use:
(define-syntax define-quotation-macros (syntax-rules () ((_ (macro-name head-symbol) ...) (begin (define-syntax macro-name (syntax-rules () ((_ x (... ...)) '(head-symbol x (... ...))))) ...))))
or can apply outer form ellipses within supposed inner:
(define-syntax define-quotation-macros (syntax-rules () ((_ (macro-name head-symbol) ...) (begin (define-syntax macro-name (... (syntax-rules () ((_ x ...) '(head-symbol x ...))))) ...))))
Comments
Post a Comment