Path: utzoo!attcan!uunet!ncc!alberta!steph From: steph@alberta.UUCP (Stephanie Miller) Newsgroups: comp.lang.lisp Subject: Re: Problems with Lisp Packages Summary: packages can be a pain! Keywords: Packages, Constants Message-ID: <2075@pembina.UUCP> Date: 24 Feb 89 15:36:10 GMT References: <117@bosco.dit.upm.es> Organization: U. of Alberta, Edmonton, AB Lines: 44 In article <117@bosco.dit.upm.es>, ibm@bosco.dit.upm.es (Ignacio Bellido Montes) writes: > > ... > I use a Hewlett-Packard 9000-350 with Lucid Common Lisp II. I made a > group of functions which made things like: > > (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. > =========================================================================== > Ignacio Bellido Fernandez-Montes, I use Lucid common lisp and had exactly the same problem when starting to use packages. There are three ways I can think of to fix the problem (and I use them all in various places). 1) Any global constants like YES or No can be exported from the main package you run things from (user hopefully). Then for each package you set up, let it "use" the user package (I'm not sure how your common lisp works, but ours lets you have a keyword parameter :use on the in-papackage command). This will make all uses of that constant be the one in the user package. 2) If you are starting from the same top level package each time, you can just prepend user:: on each constant you are testing - this only works if all you input comes from the same package originally. 3) You can use find-symbol to find that symbol in the current package, and then compare it (that only works if you have interned all possible constants you will get into the package already). 4) You can explode the constant's name, strip off the package name (ends with :)and implode the rest to get the basic constant and then compare that. I have routines that do that - let me know if you want them. Actually thats 4 ways! - Stephanie Miller steph@alberta.uucp