2010/05/29

syntax-rules: lets

Oleg さんって The Reasoned Schemer とか SXML の方ですよね。comp.lang.scheme もでしたっけ?
syntax-rules の引数ってこういうことなのか。

;; lets
;; http://okmij.org/ftp/papers/Macros-talk.pdf
;; (lets i <- (+ 1 4)
;; in (+ i 37))
;; ; -> 42
(define-syntax lets
(syntax-rules (<- in)
((_ var <- init in body ...)
(let ((var init))
body ...))))
(lets i <- (+ 1 4)
in (+ i 37))
; -> 42
view raw lets.scm hosted with ❤ by GitHub



プログラミングGaucheThe Reasoned Schemer

0 件のコメント:

コメントを投稿