Question for Lisp experts...
There are many times when one wants to locally "use" symbols belonging to another package. We don't want those symbols to be globally visible (directly) in the main body of the code, but inside of some routines, it would be convenient for them to be treated as imported symbols.Example: within a large body of code, I have just one routine that calls on a number of functions from another package. Here is one example from the Rice statistics package, where a closed-form solution for the cumulative distribution is intractable, and we must resort to numerical integration of the PDF.
To do that quickly, I utilize lazy streams with iterated acceleration of partial sums. Acceleration is by Euler's extrapolation.
(defun integrate (f a b)
(lzs:within (lzs:relerror 1d-8)
(lzs:accelerate-series #'lzs:euler
(lzs:integrate f a b))))
Here you see that all those routines being used live in the LZS package. This is the only place that LZS symbols are being used, but I want to avoid potential collisions with LZS symbols in the remainder of the code in this present package.
OCaml has a construct "with" that permits the introduction of symbols that can assume a "use" from the module named in the "with" clause. That allows local importation of the symbols for the body of the "with" clause.
Is there anything similar in Lisp?
Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ 85750
email: dbm@refined-audiometrics.com
phone: 1.520.390.3995