I'm calling a Lisp function (and a few other thing) from a shell script. For brevity, below is relevant part of the script :
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(format T "~a" (CC3::sunset (CC3::fixed-from-gregorian (CC3::gregorian-date 1996 CC3::february 25)) CC3::jerusalem))' 728714.7349874675
The above code works fine but I had to append the package name CC3 for every symbol that is used; which makes the code unwieldy and hard to type.
I tried to simplify it like so, using use-package
:
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(format T "~a" (use-package "CC3") (sunset (fixed-from-gregorian (gregorian-date 1996 february 25)) jerusalem))'
Much easier to read and type, but unfortunately it doesn't work. I've tried all sorts of ways to include the use-package
directive but so far no success.
Is it even possible to include a use-package
directive while launching a Lisp program via the GNU Common Lisp's (gcl) load directive?
Update: The solution is to use multiple evals as suggested by the accepted answer.
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(use-package "CC3")' -eval '(format T "~a" (sunset (fixed-from-gregorian (gregorian-date 1996 february 25)) jerusalem))'
Maybe you could use multiple eval, here is what I do with sbcl.
#!/bin/sh
sbcl --noinform \
--eval '(load "boot.lisp")' \
--eval '(in-package #:my-pkg)' \
--eval "(do-something-useful)" # do-something-useful is in my-pkg