开发者

Getting variable foo is unbound trying to use a quick project tutorial

I've followed the instructions here: http://xach.livejournal.com/278047.html and gotten them to work. I called the project test, so I have a test.lisp file that looks like :

;;;; test.lisp

(in-package #:test)

;;; "test" goes here. Hacks and glory await!

(defun foo ()
    (format t "hello from EMAIL-DB package~%"))

When I run (ql:quickload "test") I get: The variable FOO is unboun开发者_JS百科d. If I comment out the (in-package #:test) line, then foo is no longer unbound when I load it. Which tells me that the function foo is syntactically ok.

What am I doing wrong? Why is foo unbound when use (ql:quickload "test')?

Here's my package file:

;;;; package.lisp

(defpackage #:test
  (:use #:hunchentoot))

And my test.asd file:

;;;; test.asd

(asdf:defsystem #:test
  :serial t
  :depends-on (#:hunchentoot
               #:cl-who
               #:postmodern)
  :components ((:file "package")
               (:file "test")))


Your test package doesn't use the CL package, so your DEFUN is TEST::DEFUN (not CL:DEFUN). There's no macro definition for TEST::DEFUN, so the system proceeds to evaluate using the function call rules, which are to evaluate each subform in order, then apply the function to the values of the arguments. The first subform is TEST::FOO, which is a lookup of a variable -- and there is no such variable as TEST::FOO in your image.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜