[racket] Splicing Syntax Class Error?
Hi guys,
In Syntax: Meta-Programming Helpers 1.2.2 Optional Keyword Arguments, the splicing syntax class example is returning an error for the keyword case:
#lang racket
(require (for-syntax syntax/parse))
(define-syntax (mycond stx)
(define-splicing-syntax-class maybe-fallthrough-option
(pattern (~seq #:error-on-fallthough who:expr)
#:with error? #'#t)
(pattern (~seq)
#:with error? #'#f
#:with who #'#f))
(syntax-parse stx
[(mycond fo:maybe-fallthrough-option clause ...)
#'(mycond* fo.error? fo.who clause ...)]))
(define-syntax mycond*
(syntax-rules ()
[(mycond error? who [question answer] . clauses)
(if question answer (mycond* error? who . clauses))]
[(mycond #t who)
(error who "no clauses matched")]
[(mycond #f _)
(void)]))
>(mycond [(even? 13) 'blue]
[(odd? 4) 'red])
>(mycond #:error-on-fallthrough 'myfun
[(even? 13) 'blue]
[(odd? 4) 'red])
mycond*: bad syntax in: (mycond* #f #f #:error-on-fallthrough (quote myfun) ((even? 13) (quote blue)) ((odd? 4) (quote red)))
Am I missing something? Thanks!
—Kevin