Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defmacro for ((init test increment) &body body)
- (let ((loop (make-symbol "loop"))
- (end (make-symbol "end")))
- `(tagbody
- ,init
- ,loop
- (unless ,test (go ,end))
- (progn ,@body)
- ,increment
- (go ,loop)
- ,end)))
- (let (a)
- (for ((setf a 0) (< a 5) (incf a 2))
- (format t "value of i: ~D q: ~D~%" a (1+ a))))
- value of i: 0 q: 1
- value of i: 2 q: 3
- value of i: 4 q: 5
- nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement