【发布时间】:2025-12-20 15:35:11
【问题描述】:
我正在从一个 shell 脚本调用一个 Lisp 函数(和其他一些东西)。为简洁起见,以下是脚本的相关部分:
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(格式 T "~a" (CC3::sunset (CC3::fixed-from-gregorian (CC3::gregorian-date 1996 CC3::2 月 25 日)) CC3::耶路撒冷))' 728714.7349874675
上面的代码工作正常,但我必须为每个使用的符号附加包名 CC3;这使得代码笨拙且难以输入。
我试着像这样简化它,使用use-package:
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(格式 T "~a" (use-package "CC3") (sunset (fixed-from-gregorian (gregorian-date 1996 february 25)) jerusalem))'
更容易阅读和输入,但不幸的是它不起作用。我尝试了各种方法来包含use-package 指令,但到目前为止都没有成功。
是否可以在通过 GNU Common Lisp (gcl) 加载指令启动 Lisp 程序时包含 use-package 指令?
更新: 解决方案是按照接受的答案的建议使用多个评估。
./gcl -load /tmp/calendrica-3.0.cl -batch -eval '(use-package "CC3")' -eval '(format T "~a" (sunset (fixed-from-gregorian (gregorian-date 1996 年 2 月 25 日)) 耶路撒冷))'
【问题讨论】:
标签: shell batch-file common-lisp gnu-common-lisp