about the define-match-expansion, there are rare materials and example codes to illustrate the concepts. I am having a hard time to "decode" what the documentation says:
(define-match-expander id proc-expr)
(define-match-expander id proc-expr proc-expr)
Binds id to a match expander.
The first proc-expr subexpression must evaluate to a transformer that produces a pat for match. Whenever id appears as the beginning of a pattern, this transformer is given, at expansion time, a syntax object corresponding to the entire pattern (including id). The pattern is the replaced with the result of the transformer.
A transformer produced by a second proc-expr subexpression is used when id is used in an expression context. Using the second proc-expr, id can be given meaning both inside and outside patterns.
Can anyone give some example codes to illustrate the two usages of the define-match-expander here?