Created
February 10, 2018 17:38
-
-
Save fabienhinault/9ce968424429319a0160a95ef5597d88 to your computer and use it in GitHub Desktop.
primitive definition of hyphen-define from http://www.greghendershott.com/fear-of-macros/pattern-matching.html
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (define-syntax (hyphen-define/0.9 stx) | |
| (let* [(l (syntax->datum stx)) | |
| (a (second l)) | |
| (b (third l)) | |
| (args (fourth l)) | |
| (body (cddddr l)) | |
| (name (string->symbol (format "~a-~a" a b)))] | |
| (datum->syntax stx `(define (,name . ,args) ,@body)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment