[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

LOOP question



Hi,
   I am having problems with the following loop construct which
evaluates differently in LUCID and CLISP:

;;;-------------------------------------------------
lucid>   (loop for i in '(1 2 3)
           for j = (1+ i)
           for k = (1- i)
           do (print (list j k))
           collect (* j k))
(2 0) 
(3 1) 
(4 2) 
(0 3 8)

;;;-------------------------------------------------
;;;-------------------------------------------------
clisp>   (loop for i in '(1 2 3)
           for j = (1+ i)
           for k = (1- i)
           do (print (list j k))
           collect (* j k))
(2 0) 
(3 1) 
(4 2) 
*** - argument to 1+ should be a number: NIL
1. Break> 
;;;-------------------------------------------------

Are the 2 "for"-bindings for j and k resp. supposed (allowed) to be
evaluated when the end of the list has already been reached (i.e., when
i is NIL)?


Regards,
Wilbur.

---
Wilhelm Burger, Johannes Kepler University, A-4040 Linz, Austria
Email:wilbur@cast.uni-linz.ac.at/Tel: +43 732 2468 898, Fax: 893