Importing packages in SLIME
Posted: Fri Jun 01, 2012 4:24 am
There's something I can't understand about importing symbols or entire packages when in SLIME's REPL.
Suppose I want to use a socket, my inferior lisp program is SBCL, so I want to import several symbols from it, what I tried:
or
Both will argue about the symbols I'm trying to use are already in the common-lisp-user package, but they offer to resolve it, giving me two choices, either use those in cl-user, or those from sbcl package. I choose to use those in sbcl, which seems to resolve the error. Next, I try this:
which works, but I don't like long names, so if I then try:
It doesn't work, saying that the functions I'm trying to call are undefined - even though I've just imported them! If I do in REPL:
That is, it knows what it is, but it just will not use it...
This must be something special about SLIME because the same code executed as a shell script or directly from interactive shell with SBCL running in it would work.
So, my question is: what's happening? How to "fix" it, of course
Suppose I want to use a socket, my inferior lisp program is SBCL, so I want to import several symbols from it, what I tried:
Code: Select all
(import 'sb-bsd-sockets:host-ent-address)
(import 'sb-bsd-sockets:get-host-by-name)
Code: Select all
(use-package :sb-bsd-sockets)
Code: Select all
(defun nslookup (hostname)
(if hostname
(sb-bsd-sockets:host-ent-address (sb-bsd-sockets:get-host-by-name hostname))
nil))
Code: Select all
(defun nslookup-1 (hostname)
(if hostname
(host-ent-address (get-host-by-name hostname))
nil))
Code: Select all
#'host-ent-address
#<STANDARD-GENERIC-FUNCTION HOST-ENT-ADDRESS (1)>
This must be something special about SLIME because the same code executed as a shell script or directly from interactive shell with SBCL running in it would work.
So, my question is: what's happening? How to "fix" it, of course
