Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cwjcc!tut.cis.ohio-state.edu!rutgers!mit-eddie!mit-amt!sokolov From: sokolov@mit-amt (Michael Sokolov) Newsgroups: comp.lang.lisp Subject: Re: Problems with Lisp Packages Keywords: Packages, Constants Message-ID: <3591@mit-amt> Date: 26 Feb 89 20:12:47 GMT References: <117@bosco.dit.upm.es> Reply-To: sokolov@media-lab.media.mit.edu (Michael Sokolov) Organization: MIT Media Lab, Cambridge MA Lines: 27 In article <117@bosco.dit.upm.es> ibm@bosco.UUCP (Ignacio Bellido Montes) writes: > (DEFUN FOO (X) > (COND ((EQUAL (CAR X) 'YES) ... ) > ((EQUAL (CAR X) 'NO) ... ) > (T (PRINT 'ERROR))) > ) > > When the current package is the same where the function is defined, >the function is well evaluated. But when I use the function from another >package, using (PACKAGE-FOO::FOO), the predicate EQUAL fails. This can be very annoying. The problem is that there are two different symbols: foo is defined differently in two packages. There are a few things you can do. One is to use strings instead of symbols. Another is to use keywords (symbols beginning with a ":", like :yes and :no), which are ALL defined in the keyword package and are thus shared by other packages. Finally, (kind of ugly) if you really insist on doing what you describe, you can do the following (in package foo): (in-package 'foo) (defun test (x) ... (equal (find-symbol (car x) 'foo) 'yes) ...) Happy hacking! -MS