Skip to content

Instantly share code, notes, and snippets.

@ruliana
Created January 12, 2018 18:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ruliana/484a4ee0b1c4e2e3084319eec84c737a to your computer and use it in GitHub Desktop.
Save ruliana/484a4ee0b1c4e2e3084319eec84c737a to your computer and use it in GitHub Desktop.
A macro that generates a new pattern for pattern matching
(define-syntax-rule (define-pattern (name args ...) substitution)
(define-match-expander name
(syntax-rules ()
[(_ args ...) substitution])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment