2011-03-14 86 views
1

我想改寫這個:方案:定義語法規則的模式匹配語法

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

使用(定義語法規則的圖案模板),但我似乎無法得到正確的語法。任何建議表示讚賞。

謝謝。

回答

1

嘗試:

(define-syntax-rule (match-rewriter (patt body) ...) 
    (lambda (x) (match x (patt body) ... (_ x)))) 
+0

謝謝!這幾乎就是我正在使用的內容,但現在我發現我有一對額外的圓括號拋棄了這種模式。 – Schemer 2011-03-14 00:45:31