I have a symbol foo and a function called foo as well, in the package
"USER". I want to import the symbol foo in a package "my-package".
How do I do that? With (import user:foo) only the function is imported,
but if I say (print foo) gives an error.
Please, help.
On 19 Mar 1997 18:55:16 GMT, marisal <·······@wrq.com> wrote:
>I have a symbol foo and a function called foo as well, in the package
>"USER". I want to import the symbol foo in a package "my-package".
>How do I do that? With (import user:foo) only the function is imported,
>but if I say (print foo) gives an error.
>Please, help.
You forget the quote, it should be:
(import 'user:foo)
IMPORT is a function so without a quote you import the value of FOO instead
of the symbol FOO itself. Why the function seemed to be imported must have
been a side effect of something you did before. (describe 'my-package:foo)
would show whether FOO came from "USER" or was interned in "my-package".
--Vassili
In article <············@wrqnews.wrq.com>, marisal <·······@wrq.com> wrote:
> I have a symbol foo and a function called foo as well, in the package
> "USER". I want to import the symbol foo in a package "my-package".
> How do I do that? With (import user:foo)
Missing quote?
> only the function is imported,
> but if I say (print foo) gives an error.
> Please, help.
You can *only* deal with symbols using Common Lisp's packages.
There is nothing like exporting a function. Symbols can
have function values and/or ordinary values.
The following works for me.
(defpackage "BAR")
(in-package "BAR")
(defparameter *foo* 13)
*foo*
(in-package "CL-USER")
(import 'bar::*foo*)
*foo*
--
http://www.lavielle.com/~joswig/