2010/05/25

syntax-rules: let1

こうかな。
;; let1
(define-syntax letone
(syntax-rules ()
((_ () body ...)
(let ()
body ...))
((_ (var init) body ...)
(let ((var init))
body ...))))
(letone (x 10)
(display x))
(letone ()
(display 1)))
view raw let1.scm hosted with ❤ by GitHub

追記

間違ってるな。
(define-syntax letone
(syntax-rules ()
((_ var init body ...)
(let ((var init))
body ...))))
(letone a 1
(display a))
view raw let1-2.scm hosted with ❤ by GitHub


プログラミングGauche

0 件のコメント:

コメントを投稿