stop will be evaluated only once and the result will be saved into the stop-cond, but we've captured stop-cond (we can't reach hypotetical outer stop-cond defined in let which is wrapping our for), hence we create gstop which its value is a unique generated symbol and unquote it at appropriate places where stop-cond was used.

Last edited by Goheeca on Sun Dec 02, 2012 8:10 am, edited 1 time in total.

HI Goheeca and thankf for your help!Ok I understand reason to use gensym in macro , but yet it is not clear to me why using *,stop* instead *gstop*(gensym variable) in *do* test conditions return NIL..For example You said that *,stop* will be evaluated only once, but if I ridefine *for* macro in this way and without use gensym expr, it’ll works as I expect:

When you have a misbehaving macro you should use MACROEXPAND to see that it is expanding to what you want it to. If you use emacs+slime, then you can put the cursor at the opening paren of the form and then typing C-c return