linux 如何在命令行上运行包含SBCL Lisp代码的文件

gz5pxeao  于 4个月前  发布在  Linux
关注(0)|答案(1)|浏览(53)

我刚刚安装了SBCL(在Rapberry PI上),使用:

pi# apt install sbcl

字符串
我注意到,与clisp不同的是,把:

#!/usr/bin/sbcl


不允许我从命令行运行Lisp脚本文件。
所以我的问题是,一旦我的Lisp代码被写入并存储在一个名为test的文件中,我需要做什么-以及如何-(向文件中添加一些东西?或者编译它?或者.)才能从命令行运行它?
更多详情:
以下是终端中发生的事情:

pi@raspberrypi:~/SBCL $ cat test
#!/usr/bin/sbcl

(defun HI()
(let (vx 0)
(setf vx (+ (* 3 5) (mod 27 7)))
(format t "~a~%" vx)
))

(HI)

pi@raspberrypi:~/SBCL $ ls -l test 
  -rwxr-xr-x 1 pi pi 104 Dec  2 05:41 test
pi@raspberrypi:~/SBCL $ ./test 
This is SBCL 2.2.9.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.

SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses.  See the CREDITS and COPYING files in the
distribution for more information.
*

lskq00tm

lskq00tm1#

手册中有一个简短的章节。

#!/usr/bin/sbcl --script

(your Lisp code here)

字符串
当然,你必须知道shebang这个术语才能找到它。

相关问题