Last active
January 8, 2018 11:10
-
-
Save ruliana/8102932aa7aea36094f25e44183b14f1 to your computer and use it in GitHub Desktop.
Example of new pattern for pattern matching in Racket
This file contains 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
#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