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)
or
- Code: Select all
(use-package :sb-bsd-sockets)
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:
- Code: Select all
(defun nslookup (hostname)
(if hostname
(sb-bsd-sockets:host-ent-address (sb-bsd-sockets:get-host-by-name hostname))
nil))
which works, but I don't like long names, so if I then try:
- Code: Select all
(defun nslookup-1 (hostname)
(if hostname
(host-ent-address (get-host-by-name hostname))
nil))
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:
- Code: Select all
#'host-ent-address
#<STANDARD-GENERIC-FUNCTION HOST-ENT-ADDRESS (1)>
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
