Hi,
I want to use a package in cl-user, is there a way to 'import' a package
in the current package on the fly, without modifying the defpackage
expression of the current package?
And another question, which is the difference between the modules that I
can load with (require ...) and the packages?
Thanks.
Giannandrea
(import 'cl-user)
On Fri, 12 Mar 2004 18:16:34 +0100, Giannandrea Castaldi
<········@tiscali.it> wrote:
> Hi,
> I want to use a package in cl-user, is there a way to 'import' a package
> in the current package on the fly, without modifying the defpackage
> expression of the current package?
> And another question, which is the difference between the modules that I
> can load with (require ...) and the packages?
>
> Thanks.
>
> Giannandrea
>
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/
Giannandrea Castaldi <········@tiscali.it> writes:
> Hi,
> I want to use a package in cl-user, is there a way to 'import' a
> package in the current package on the fly, without modifying the
> defpackage expression of the current package?
(in-package 'cl-user) ;; just to make sure you're in it ...
(use-package 'some-package)
Now all exported symbols of `some-package' are accessible in cl-user.
> And another question, which is the difference between the modules that
> I can load with (require ...) and the packages?
That's the wrong question. The right question is, is there any
guaranteed relationship between "modules" (defined as "whichever files
`require' happens to load") and packages? The answer to that is no.
When you require something, the file(s) that are loaded can define
packages or not -- it's entirely up to them.
Hope that helps,
Rudi
You want USE-PACKAGE.
Of course that may cause conflicts. E.g. suppose you have a package like
(defpackage "INDUSTRIES" (:use) (:export "CAR" "FOOD" "WOOL"))
at the promopt you can do the following
cl-prompt> *package*
#<PACKAGE COMMON-LISP-USER>
cl-prompt> (package-use-list "COMMON-LISP-USER")
("#<PACKAGE COMMON-LISP> ...)
cl-prompt> (use-package "INDISTRIES")
===> Error. CL:CAR and INDUSTRIES:CAR conflict.
Cheers
Marco
Giannandrea Castaldi wrote:
> Hi,
> I want to use a package in cl-user, is there a way to 'import' a package
> in the current package on the fly, without modifying the defpackage
> expression of the current package?
> And another question, which is the difference between the modules that I
> can load with (require ...) and the packages?
>
> Thanks.
>
> Giannandrea
>