#lang scheme
(require srfi/26)
(define-match-expander match:eq?
(syntax-rules ()
[(_ expr pattern ...)
(? (cut eq? <> expr) pattern ...)])
eq?)
(define-match-expander match:equal?
(syntax-rules ()
[(_ expr pattern ...)
(? (cut equal? <> expr) pattern ...)])
equal?)
(define-match-expander app*
(syntax-rules ()
[(_ expr pattern)
(app expr pattern)]
[(_ expr pattern ...)
(app (lambda (val)
(call-with-values (cut expr val) list))
(list pattern ...))]))
(provide (rename-out [match:eq? eq?]
[match:equal? equal?])
app*)