Advertisement
Guest User

Untitled

a guest
Jan 2nd, 2019
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. (defmacro for ((init test increment) &body body)
  2. (let ((loop (make-symbol "loop"))
  3. (end (make-symbol "end")))
  4. `(tagbody
  5. ,init
  6. ,loop
  7. (unless ,test (go ,end))
  8. (progn ,@body)
  9. ,increment
  10. (go ,loop)
  11. ,end)))
  12.  
  13. (let (a)
  14. (for ((setf a 0) (< a 5) (incf a 2))
  15. (format t "value of i: ~D q: ~D~%" a (1+ a))))
  16. value of i: 0 q: 1
  17. value of i: 2 q: 3
  18. value of i: 4 q: 5
  19. nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement