阅读终端参数并在Lisp中传递函数?

问题描述

(defun gppinterpreter (filename)
    (setq fileContent (read-a-file filename))
    (write filecontent)
)
(gppinterpreter filename)

我在ubuntu中编译该文件

cli example.lisp

我想直接从终端获取filename参数,例如>> cliexample.lisp filename

,但是此命令不起作用。如何从终端获取gpp解释器中的文件名参数

解决方法

在Clisp中,程序参数在变量EXT:*ARGS*.中给出。

https://clisp.sourceforge.io/impnotes/clisp.html

在加载之前,将变量EXT: ARGS 绑定到STRING的LIST上,表示赋予Lisp脚本的参数(即/ bin / sh中的$ 1变为(FIRST EXT: ARGS )等。

所以我认为您想使用(second EXT:*ARGS*)