开发者

A variable becomes undefined after referencing it in a defun

Hel开发者_如何学JAVAlo good people of stackoverflow, I am having a weird problem while following Adam Peterson's Lisp for the Web tutorial. The problem in question is probably a problem with Clozure CL, however I just wanted to provide some background.

What's happening is simple. I declare the variable *games* by doing (defvar *games* '()). When I declare a function that references this variable, such as game-from-name, the compiler just yells at me undeclared free variable *games*.

Does anyone know why this is happening?


You could be executing in a different package. Try examining the value of the *in-package* variable at the points where you define and access the variable to check which package is current. You use the in-package macro to set the current package.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜