Skip to content

Instantly share code, notes, and snippets.

@fabienhinault
Created February 10, 2018 17:38
Show Gist options
  • Save fabienhinault/9ce968424429319a0160a95ef5597d88 to your computer and use it in GitHub Desktop.
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
(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