Add match*? to unstable/match
original commit: 12e5bc645bf6e4c8c74cd6460efefccbf5a5680d
This commit is contained in:
parent
a598ba1617
commit
154824c9af
|
@ -5,7 +5,7 @@
|
|||
(for-syntax racket/base)
|
||||
(for-syntax syntax/parse))
|
||||
|
||||
(provide match? as object)
|
||||
(provide match? match*? as object)
|
||||
|
||||
(define-syntax-rule (match? e p ...)
|
||||
(match e [p #t] ... [_ #f]))
|
||||
|
@ -14,6 +14,14 @@
|
|||
(syntax-rules ()
|
||||
[(as ([x e] ...) p ...) (and (app (lambda (y) e) x) ... p ...)]))
|
||||
|
||||
;; Added by asumu
|
||||
;; Like match? but with match*
|
||||
(define-syntax (match*? stx)
|
||||
(syntax-parse stx
|
||||
[(_ (e ...) (p ...) ...)
|
||||
(with-syntax ([(?_ ...) (generate-temporaries #'(e ...))])
|
||||
#'(match* (e ...) [(p ...) #t] ... [(?_ ...) #f]))]))
|
||||
|
||||
;; Added by asumu
|
||||
;; Match expander for objects from racket/class
|
||||
(define-match-expander object
|
||||
|
|
Loading…
Reference in New Issue
Block a user