Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; dotimes
- (define-syntax dotimes
- (syntax-rules ()
- ((_ n body ...)
- (let loop ((i n))
- (when (< 0 i)
- body ...
- (loop (- i 1)))))))
- (dotimes 5 (print 1))
- (define i 10)
- (dotimes 5 (print (set! i (+ i 1))))
- ;; 11
- ;; 12
- ;; 13
- ;; 14
- ;; 15
- (macroexpand-1 '(dotimes 5 (print (set! i (+ i 1)))))
- ;; (#<identifier user#let> #0=#<identifier user#loop>
- ;; ((#1=#<identifier user#i> 5))
- ;; (#<identifier user#when>
- ;; (#<identifier user#<> 0 #1#)
- ;; (print (set! i (+ i 1)))
- ;; (#0# (#<identifier user#-> #1# 1))))
Add Comment
Please, Sign In to add comment