How to use a fender in "syntax-case" form? I got a example today.
;; utility for defining ~foo but make it look like #<procedure:foo>
(define-syntax (define* stx)
(syntax-case stx ()
[(_ ~name val) (identifier? #'~name)
(let* ([~str (symbol->string (syntax-e #'~name))]
[str (string->symbol (regexp-replace #rx"^[~*]" ~str ""))])
(with-syntax ([name (datum->syntax-object #'~name str #'~name)])
#'(define ~name (let ([name val]) (mark-lazy name)))))]
[(_ (~name . xs) body ...) (identifier? #'~name)
#'(define* ~name (lambda xs body ...))]))
I got other examples. However, they are wrong and can not be parsed correctly.
According to the above example, I wrote another simple macro.
(define-syntax m
(lambda (x)
(syntax-case x ()
((_ ~name) (not (identifier? #'~name))
#'~name))))