This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; shadow | |
(define-syntax shadow | |
(syntax-rules () | |
((_ used-arg val body) | |
(let ((used-arg val)) | |
body)))) | |
(define a 1) | |
a | |
; -> 1 | |
(shadow a 10 | |
a) | |
; -> 10 | |
a | |
; -> 1 | |
では、こうしたら。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(define-syntax shadows | |
(syntax-rules () | |
((_ ((used-arg val) ...) body ...) | |
(let ((used-arg val) ...) | |
body ...)))) | |
(define b 100) | |
b | |
; -> 100 | |
(define c "Hello") | |
c | |
; -> "Hello" | |
(define d 'dead) | |
d | |
; -> dead | |
(shadows ((a b) | |
(b 5) | |
(c "world") | |
(d 'live)) | |
(values a b c d)) | |
;; 100 | |
;; 5 | |
;; "world" | |
;; live |
おー。便利。
待てよ、これなんてlet?
展開。
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let ((- 'minus)) | |
(macroexpand | |
'(dotimes 5 (print "hello")))) | |
;; (#<identifier user#let> #0=#<identifier user#loop> | |
;; ((#1=#<identifier user#i> 5)) | |
;; (#<identifier user#when> | |
;; (#<identifier user#<> 0 #1#) | |
;; (print "hello") | |
;; (#0# (#<identifier user#-> #1# 1)))) |
0 件のコメント:
コメントを投稿