gpt4 book ai didi

shell - 是否存在在 Common Lisp 中运行外部程序的标准方法?

转载 作者:行者123 更新时间:2023-12-04 00:45:07 26 4
gpt4 key购买 nike

在 clisp 中,以下代码有效:

(defun hit-history () (shell "tail ssqHitNum.txt"))

但是,在 Clozure CL 中, shell不支持功能!

最佳答案

不,没有标准的方法,但是有一些库为重要的实现提供了这个功能。例如,在 Quicklisp 中有可用的 trivial-shell ,提供 shell-command . (我实际上并没有测试它,但它在 recommended libraries 上的 CLiki 中。)还有外部程序。更新:inferior-shell这些天似乎更受欢迎,正如 Ehvince 在评论和他自己的回答中指出的那样。

您还可以使用读取时间条件使不同的实现使用它们各自的功能来执行此操作。

覆铜板有ccl:run-program , 例如:

CL-USER> (run-program "whoami" '() :output *standard-output*)
foobar
#<EXTERNAL-PROCESS (whoami)[NIL] (EXITED : 0) #xC695EA6>

关于shell - 是否存在在 Common Lisp 中运行外部程序的标准方法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7721081/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com