Skip to content

Instantly share code, notes, and snippets.

@ruliana
Last active January 8, 2018 11:10
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/8102932aa7aea36094f25e44183b14f1 to your computer and use it in GitHub Desktop.
Save ruliana/8102932aa7aea36094f25e44183b14f1 to your computer and use it in GitHub Desktop.
Example of new pattern for pattern matching in Racket
#lang racket
(define-match-expander aba
(syntax-rules ()
[(aba a b) (list a b a)]))
(define some-list (list 4 3 4))
(match some-list
[(aba x y) (printf "x = ~a, y = ~a\n" x y)])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment