Hi,
I am trying to learn packages (from Practical Common Lisp). When I
run the following code in SLIME:
(defpackage :foo
(:use :common-lisp))
(in-package :foo)
and then check *package*, I get
;;;; (defpackage :foo (:use :common-lisp)) ...
;;;; (in-package :foo) ...
CL-USER> *package*
#<The COMMON-LISP-USER package, 4/9 internal, 0/9 external>
Shouldn't *package* hold foo after the in-package? My understanding
(from the book) that it should, maybe I am doing something wrong.
Thanks,
Tamas
--
Posted via a free Usenet account from http://www.teranews.com
Tamas Papp <······@gmail.com> writes:
> Hi,
>
> I am trying to learn packages (from Practical Common Lisp). When I
> run the following code in SLIME:
>
> (defpackage :foo
> (:use :common-lisp))
>
> (in-package :foo)
>
> and then check *package*, I get
>
> ;;;; (defpackage :foo (:use :common-lisp)) ...
> ;;;; (in-package :foo) ...
> CL-USER> *package*
> #<The COMMON-LISP-USER package, 4/9 internal, 0/9 external>
>
> Shouldn't *package* hold foo after the in-package? My understanding
> (from the book) that it should, maybe I am doing something wrong.
Nothing, but slimes keeps track of different "current packages" for
the different source files. Evaluting with slime (in-package xyz) in
some source file doesn't modify the *PACKAGE* in the slime-repl.
Try to copy-and-paste (in-package :foo) in the slime-repl and see the
value of *package* in there, or evaluate *package* in the same source
file where you evaluated (in-package :foo).
Have a look at:
http://bc.tech.coop/blog/070424.html
--
__Pascal Bourguignon__ http://www.informatimago.com/
NOTE: The most fundamental particles in this product are held
together by a "gluing" force about which little is currently known
and whose adhesive power can therefore not be permanently
guaranteed.
Tamas Papp <······@gmail.com> writes:
> ;;;; (defpackage :foo (:use :common-lisp)) ...
> ;;;; (in-package :foo) ...
> CL-USER> *package*
> #<The COMMON-LISP-USER package, 4/9 internal, 0/9 external>
If you want to change the package *on the repl*, you must do (in-package :foo)
on the repl as well. It looks like you did it via C-M-x.
Eirik
Tamas Papp wrote:
> Hi,
>
> I am trying to learn packages (from Practical Common Lisp). When I
> run the following code in SLIME:
>
> (defpackage :foo
> (:use :common-lisp))
>
> (in-package :foo)
>
> and then check *package*, I get
>
> ;;;; (defpackage :foo (:use :common-lisp)) ...
> ;;;; (in-package :foo) ...
> CL-USER> *package*
> #<The COMMON-LISP-USER package, 4/9 internal, 0/9 external>
>
> Shouldn't *package* hold foo after the in-package? My understanding
> (from the book) that it should, maybe I am doing something wrong.
>
> Thanks,
>
> Tamas
>
I find this "tutorial" particularly helpfull :
http://www.flownet.com/gat/packages.pdf
dg