Skip to content

Instantly share code, notes, and snippets.

@SaitoAtsushi
Created January 23, 2014 13:06
Show Gist options
  • Save SaitoAtsushi/8578166 to your computer and use it in GitHub Desktop.
Save SaitoAtsushi/8578166 to your computer and use it in GitHub Desktop.
Sagittarius 0.5.0 のバグ?
#!r6rs
;; Sagittarius 0.5.0 のバグ?
(import (rnrs))
(define-syntax let/scope
(lambda(x)
(syntax-case x ()
((k scope-name body ...)
#'(let-syntax
((scope-name
(lambda(x)
(syntax-case x ()
((_ b (... ...))
#`(begin
#,@(datum->syntax #'k
(syntax->datum #'(b (... ...))))))))))
body ...)))))
(write
(let ((x 1))
(let/scope d1
(let ((x 2))
(let/scope d2
(let ((x 3))
(let/scope d1
(list (d2 (d1 x)) (d2 x) x))))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment