1

I would like to rewrite this:

(define-syntax match-rewriter
  (syntax-rules ()
    ((_ (patt body) ...)
      (λ (x) (match x (patt body) ... (_ x))))))

using (define-syntax-rule pattern template) but I can't seem to get the syntax right. Any advice is appreciated.

Thanks.

1 Answer 1

1

Try:

(define-syntax-rule (match-rewriter (patt body) ...)
  (lambda (x) (match x (patt body) ... (_ x))))
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! That's almost exactly what I was using but I see now that I had an extra pair of parentheses throwing off the pattern.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.