I try to run this code in clisp:
(defun gen-world
(loop for x to *hight*
do (loop for y to *width*
do (acons '(x . y) '(rock) *world*))))
And get the following error:
*** - APPLY: argument list given to SYSTEM::ERROR-OF-TYPE is dotted
(terminated by
"Invalid specialized parameter in method lambda list
(LOOP FOR X TO *HIGHT* DO
(LOOP FOR Y TO *WIDTH* DO (ACONS '(X . Y) '(ROCK) *WORLD*))): (LOOP FOR Y IN
*WIDTH* DO (ACONS '(X . Y) '(ROCK) *WORLD*))"
)
When I run
(acons '(x . y) '(rock) *world*)
I get no errors
Why do this happen?
EDIT: *hight* *width* and *world* are global and in scope. *world* is a list.
I can see two problems here.
LOOPform is taken as the argument list instead. And it happens to contain a dotted pair(X . Y)which is not allowed.'(X . Y)when you probably wanted a pair containing the (integer) values ofXandY.Try this: