这是我的代码:
(defpackage :com.yves.tests (:use :common-lisp)) (in-package :com.yves.tests) (require :usocket)每次我评估require指令时,都会收到此错误:
LOAD: A file with name #1=USOCKET does not exist [Condition of type SYSTEM::SIMPLE-FILE-ERROR]当然我在我的REPL中使用quickload安装了包:
CL-USER> (ql:quickload "usocket") To load "usocket": Load 1 ASDF system: usocket ; Loading "usocket" ("usocket") CL-USER>实际上我昨天晚上安装了它,我的所有代码都在评估,没有抱怨。 今天我重温了Emacs和史莱姆。 我得到了这个错误。 还有其他配置要做吗?
这是我的加载路径中的内容:
CL-USER> (princ custom:*load-paths*) (/Users/yves/quicklisp/ /opt/local/lib/clisp-2.49/dynmod/ ./ ~/lisp/**/) (#P"/Users/yves/quicklisp/" #P"/opt/local/lib/clisp-2.49/dynmod/" #P"./" "~/lisp/**/") CL-USER>我应该手动添加每个新包装的路径吗? 是不是quicklisp初始化应该执行它本身?
Here is my code:
(defpackage :com.yves.tests (:use :common-lisp)) (in-package :com.yves.tests) (require :usocket)Everytime I evaluate the require directive, I get this error:
LOAD: A file with name #1=USOCKET does not exist [Condition of type SYSTEM::SIMPLE-FILE-ERROR]Of course I installed the package with quickload in my REPL:
CL-USER> (ql:quickload "usocket") To load "usocket": Load 1 ASDF system: usocket ; Loading "usocket" ("usocket") CL-USER>Actually I've installed it yesterday evening, and all my code was evaluating with no complain. Today I restarded Emacs and Slime. And I get this error. Is there additional configuration to do?
Here is what is in my loadpath:
CL-USER> (princ custom:*load-paths*) (/Users/yves/quicklisp/ /opt/local/lib/clisp-2.49/dynmod/ ./ ~/lisp/**/) (#P"/Users/yves/quicklisp/" #P"/opt/local/lib/clisp-2.49/dynmod/" #P"./" "~/lisp/**/") CL-USER>Am I supposed to add the path to every new package by hand? Isn't quicklisp initialisation supposed to perform it, by itself?
最满意答案
Require不是此处所需的操作。
在简单的情况下,您将整个系统放在一个自给自足的文件中,您可以将ql:quickload表单包装到eval-when :
(in-package #:cl-user) (eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload "usocket")) (defpackage #:com.yves.tests (:use #:cl)) (in-package #:com.yves.tests) ;; your code here如果您想在没有限定usocket情况下使用来自usocket符号, usocket在defpackage表单中使用它:
(defpackage #:com.yves.tests (:use #:cl #:usocket))如果您有一个跨越多个文件的更大系统,则可以使用ASDF。 快速项目是一种快速实现简单设置的quickproject ,也可以从Quicklisp获得。
Require is not the required operation here.
In the simple case where you have your entire system in one self-sufficient file, you can wrap ql:quickload forms into an eval-when:
(in-package #:cl-user) (eval-when (:compile-toplevel :load-toplevel :execute) (ql:quickload "usocket")) (defpackage #:com.yves.tests (:use #:cl)) (in-package #:com.yves.tests) ;; your code hereIf you want to use symbols from usocket without qualification, use it in the defpackage form:
(defpackage #:com.yves.tests (:use #:cl #:usocket))If you have a bigger system that spans several files, you can use ASDF. A quick way to get a simple setup running is quickproject, also available from Quicklisp.
更多推荐
发布评论