[racket] Macro Help

From: Sam Tobin-Hochstadt (samth at ccs.neu.edu)
Date: Sun Feb 26 21:01:27 EST 2012

On Sun, Feb 26, 2012 at 8:39 PM, Neil Van Dyke <neil at neilvandyke.org> wrote:
> I suggest forgetting about "syntax-rules", and using Ryan Culpepper's
> "syntax-parse" instead.

Here's a version using `syntax-parse':

(require (for-syntax syntax/parse))

(define-syntax (function stx)
  (syntax-parse stx #:literals (->)
    [(_ (~seq (~and (~not ->) args) ... -> body:expr) ...)
     #'(match-lambda*
       [(list args ...) body]
       ...)]))

-- 
sam th
samth at ccs.neu.edu

Posted on the users mailing list.