about "do" expression

feilong <[email protected]>
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
Hallo friends,
Why does not this do expression run?
1    (do ((x 1 (+ x 1))
2             (y x x))
3           ((> x 5))
4          (format t "(~A ~A) " x y))
Error: Attempt to take the value of the unbound variable `X'.
[condition type: UNBOUND-VARIABLE]

I think that the variable y in row 2 can refer to the variable x. In the 
first iteration has x been intialised to 1, while do is parallel 
evaluation, that menas, y can refer to x and assign y to 1. Why does 
intepreter give wrong report.

why does this do expression run?
(let ((x 'a))
         (do ((x 1 (+ x 1))
             (y x x))
           ((> x 5))
          (format t "(~A ~A) " x y))
(1 A)
(2 1)
(3 2)
(4 3)
(5 4)
NIL

I have only added a "let" expression and in "let" initialised x with 'a. 
 In previous "do" expression I have also initialised x with value 1. 
Whether can not  y direkt refer to x without "let" to initialise x in 
outmost enviroment?   What difference is there in this "do" expression 
with "let" and previous "do" expression without "let"?

Best Greetings
Xu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.