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

Re: undeclared variables



Steven Dobbs (sdobbs@trivia.coginst.uwf.edu)  writes:
 in the following piece of code,
why am I getting the undeclared free variable warnings?
   (setq x t
         y t
         z nil)
? (and x (or z y))
;Compiler warnings :
;   Undeclared free variable Z, in an anonymous lambda form.
;   Undeclared free variable Y, in an anonymous lambda form.

This "problem" occurs in the or construction and not in  the and:
? (or z y)
;Compiler warnings :
;   Undeclared free variable Z, in an anonymous lambda form.
;   Undeclared free variable Y, in an anonymous lambda form.
t

? (and z y)
nil

If you want to avoid the warning messages, declare z and y to be
variables
(defvar z t)
(defvar y t)
(defvar z t)

mark