Page 1 of 1

Don't understand (when = (...))

Posted: Sat Nov 26, 2011 7:26 pm
by August
I was playing around with DO in Lispworks and did a macro expansion of a simple example.

Code: Select all

(BLOCK NIL
  (LET ((I 0))
    (DECLARE (IGNORABLE I))
    (DECLARE)
    (TAGBODY
     #:G727  (WHEN = (RETURN-FROM NIL (PROGN I 10)))
             (PRINT "hello")
             (SETQ I (1+ I))
             (GO #:G727))))
This all makes sense to me except for the (when = (...)). Shouldn't there be a test form where the "=" resides? I did the same expansion in Clozure CL and it is similar, but uses an (unless = (...)).

Re: Don't understand (when = (...))

Posted: Sat Nov 26, 2011 10:40 pm
by jcbeaudoin
What you show seems to be coming from the macro expansion of DO* rather than DO.

The end-test-form of your DO* is most probably at the wrong nesting level, just add a pair of parentheses ( ) around it.

Re: Don't understand (when = (...))

Posted: Sun Nov 27, 2011 10:57 am
by August
It was definitely a DO form and I tested it to make sure it worked as expected but, you're right, I must have missed a pair of parenthesis somehow when doing the expansion :oops:

Thanks much.