Re: symbold and packages

Michael Hannemann <[email protected]> Thu, 08 Jul 2004 19:55:34 -0400
Newsgroups gmane.lisp.allegro
Message-ID <[email protected]>
[email protected] wrote:
>You pass P1::P to P2::FP2 by calling P1::GOO.
>Then P2:FP2 prints P1::P, its argument (OK).
>Then P2:FP2 prints P2::*TEST* (OK).
>Then P2:FP2 prints (member P1::P P2::*TEST*) (which it isn't - OK).
>
>What is wrong?

Presumably he'd like to pretend that packages are irrelevant.  This might 
be a mistake, since, as you say, Lisp is doing what it's supposed to, but 
there are a few options easily available:

1.  Read the symbols in from your file and intern in the "correct" package 
in the process, with something like

   (let ((*read-eval* nil)
       (*package* (find-package the-package)))
     (read-from-string (string-upcase the-string))))

2.  Make sure all the symbols you're reading are in the keyword package, 
e.g. :x :y :z

3.  Add an alternate test to member, like

(member the-symbol the-list :test #'(lambda (x y) (string= (symbol-name x) 
(symbol-name y)))))


Michael