我正在从shell脚本中调用一个Lisp函数(以及其他一些东西)。为简洁起见,下面是脚本的相关部分:
./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
以上代码可以正常工作,但我不得不在使用的每个符号后附加包名称CC3;这使得代码笨重且难以输入。
我试图这样简化它,使用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))'
更容易阅读和输入,但不幸的是它不起作用。我尝试了各种方法来包含use-package指令,但迄今为止没有成功。
在通过GNU Common Lisp的(gcl) load指令启动Lisp程序时是否可能包含use-package指令?
更新: 解决方案是使用多个eval,如接受的答案所建议的那样。
./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))'
./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
以上代码可以正常工作,但我不得不在使用的每个符号后附加包名称CC3;这使得代码笨重且难以输入。
我试图这样简化它,使用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))'
更容易阅读和输入,但不幸的是它不起作用。我尝试了各种方法来包含use-package指令,但迄今为止没有成功。
在通过GNU Common Lisp的(gcl) load指令启动Lisp程序时是否可能包含use-package指令?
更新: 解决方案是使用多个eval,如接受的答案所建议的那样。
./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))'