Save the following DEFPACKAGE and DEFUN in a file, say, zz.lisp:

(defpackage :babu
  (:use :common-lisp))

(defun babu::hello ()
  (print "hello"))

In the same directory where you create zz.lisp, type the following into
a Unix shell:

lisp -quiet -noinit -nositeinit -eval '(progn (load "zz") (print (find-package 
:babu)) (quit))'

and you'll get #<The BABU package, 1/9 internal, 0/2 external> printed out 
on the screen.  

If you type the following into a Unix shell:

lisp -quiet -noinit -nositeinit -eval '(progn (load "zz") (babu::hello) (quit))'
you get an error:

  Reader error at 31 on #<String-Input Stream>:
  package "BABU" not found
     [Condition of type LISP::READER-PACKAGE-ERROR]

  Restarts:
    0: [ABORT] Skip remaining initializations.

  Debug  (type H for help)

  (LISP::READ-TOKEN #<String-Input Stream> #\b)
  Source: Error finding source:
  Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer 
exists:  target:code/reader.lisp.
  0]

What did I do wrong?  

Best,

-cph


Reply via email to