Kaz Kylheku
7/21/2015 1:46:00 PM
On 2015-07-21, james <dinglei2008@gmail.com> wrote:
> Hi experters,
> I meet a problem when I try to created a new package in the packae TEST.
> I don't know why i could use :use in packate cl-user but can't in TEST.
> Aslo, Is there any method to know which package a symbol belong?
>
> TEST> (make-package :ja.r (:use :cl))
>
> The function :USE is undefined.
Note that make-package is a function, not a macro. This means that
its arguments are treated as forms (expressions which are evaluated).
The form (:use :cl) is therefore also a function call.
The message is telling us that the :use keyword symbol has no function binding.
(In fact, keyword symbols *may* have function bindings!)
The fix is to study how to use make-package, instead of expecting it to
understand defpackage macro syntax.
Hint: a call to make-package cannot do everything that defpackage can;
defpackage is a syntactic interface to Lisp's broader package API which
includes functions like make-package, use-package, and intern.
make-package does, however, have a :use keyword argument to specify other
packages to be used, as a list of designators.
Hint: try (macroexpand '(defpackage :ja.r (:use :cl))) to see what your
Lisp implementation actually does under the hood.