Common Lisp中是否存在运行外部程序的标准方法? [英] Does there exist standard way to run external program in Common Lisp?

查看:85
本文介绍了Common Lisp中是否存在运行外部程序的标准方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在剪辑中,以下代码有效:

In clisp, the following code works:

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

但是,在Clozure CL中,外壳函数!

However, in Clozure CL, the shell function is not supported!

推荐答案

不,没有标准方法,但是有一些库可以为重要的实现。例如,在 Quicklisp 中有一个普通的shell,它提供了 shell-command 。 (我实际上没有对其进行测试,但是它是推荐库 CLiki 。)还有外部程序。更新:Ehvince指出,最近似乎更喜欢下壳

No, there is no standard way, but there are libraries which provide this functionality for the important implementations. For example, there's trivial-shell available in Quicklisp, which provides shell-command. (I didn't actually test it, but its among the recommended libraries on CLiki.) There is also external-program. Update: inferior-shell seems to be prefered these days, as Ehvince points out in a comment and his own answer.

您还可以使用读取条件,使不同的实现使用各自的功能来实现此目的。

You could also use read-time conditionals to make different implementations use their respective functionality to do this.

CCL具有 ccl:run-program ,例如:

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

这篇关于Common Lisp中是否存在运行外部程序的标准方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆