我是 Lisp 的初学者,只使用 DrRacket 来涉足 Racket/Scheme。我在弄清楚如何使用 Clozure CL for Windows 运行 .lisp 文件时遇到了很多麻烦。我尝试在 Ubuntu 上的 SBCL 中运行 .lisp 文件(在 virtualbox 上运行),但也没有成功。
我应该提到我已经研究了有关运行文件的相关问题,但我看不到任何直接的解决方案。有些使用 .bat 文件,有些使用 Clozure CL 的图像(或类似的东西)“创建应用程序”。
对于 Ubuntu 中的 SBCL,我尝试过:
sbcl lisptest.lisp \ The python/forth way.
(load "lisptest.lisp")
(load lisptest.lisp)
(--load lisptest.lisp)
:cd C:\Temp
(:cd C:\Temp)
Run Code Online (Sandbox Code Playgroud)
和更多。我也尝试从记事本++运行它:
cmd /k C:\Temp\ccl-1.11-windows\ccl\wx86cl64.exe "$(FULL_CURRENT_PATH)"
Run Code Online (Sandbox Code Playgroud)
这就是我通常执行python文件的方式,但是这种方法没有成功。
**我一定会开始学习使用 Emacs 和 Slime(Emacs 是 lisp 的明显选择)。但是为了知识起见,我很感激一些关于替代的基本文本编辑器方式的提示,这些方法可以打印诸如“hello world”之类的琐碎内容,而无需将其明确键入 REPL 中,而是解释(或编译)文本文件与说明。
谢谢你的帮助。
通常程序有帮助- 你看过了吗?
SBCL,Ubuntu,从外壳:
一个 Common Lisp 文件:
$ cat test.lisp
(format t "Hello World~%~%")
Run Code Online (Sandbox Code Playgroud)
SBCL 显示帮助:
$ sbcl --help
Usage: sbcl [runtime-options] [toplevel-options] [user-options]
Common runtime options:
--help Print this message and exit.
--version Print version information and exit.
--core <filename> Use the specified core file instead of the default.
--dynamic-space-size <MiB> Size of reserved dynamic space in megabytes.
--control-stack-size <MiB> Size of reserved control stack in megabytes.
Common toplevel options:
--sysinit <filename> System-wide init-file to use instead of default.
--userinit <filename> Per-user init-file to use instead of default.
--no-sysinit Inhibit processing of any system-wide init-file.
--no-userinit Inhibit processing of any per-user init-file.
--disable-debugger Invoke sb-ext:disable-debugger.
--noprint Run a Read-Eval Loop without printing results.
--script [<filename>] Skip #! line, disable debugger, avoid verbosity.
--quit Exit with code 0 after option processing.
--non-interactive Sets both --quit and --disable-debugger.
Common toplevel options that are processed in order:
--eval <form> Form to eval when processing this option.
--load <filename> File to load when processing this option.
User options are not processed by SBCL. All runtime options must
appear before toplevel options, and all toplevel options must
appear before user options.
For more information please refer to the SBCL User Manual, which
should be installed along with SBCL, and is also available from the
website <http://www.sbcl.org/>.
Run Code Online (Sandbox Code Playgroud)
使用上面的脚本选项:
$ sbcl --script test.lisp
Hello World
Run Code Online (Sandbox Code Playgroud)
Clozure CL 也一样
$ ccl --help
usage: ccl <options>
where <options> are one or more of:
-h, --help : this text
-V, --version : print (LISP-IMPLEMENTATION-VERSION) and exit
-K, --terminal-encoding : specify character encoding to use for *TERMINAL-IO*
-n, --no-init : suppress loading of init file
-e, --eval : evaluate <form> (may need to quote <form> in shell)
-l, --load : load <file>
-T, --set-lisp-heap-gc-threshold : set lisp-heap-gc-threshold to <n>
-Q, --quiet : if --batch, also suppress printing of heralds, prompts
-R, --heap-reserve <n>: reserve <n> (default: 1610612736)
bytes for heap expansion
-S, --stack-size <n>: set size of initial thread's control stack to <n>
-Z, --thread-stack-size <n>: set default size of first (listener) thread's stacks based on <n>
-b, --batch: exit when EOF on *STANDARD-INPUT*
--no-sigtrap : obscure option for running under GDB
--debug : try to ensure that kernel debugger uses a TTY for I/O
-I, --image-name <image-name>
and <image-name> defaults to ccl.image
Any arguments following the pseudoargument "--" are
not processed and are available to the application as
the value of CCL:*UNPROCESSED-COMMAND-LINE-ARGUMENTS* .
Run Code Online (Sandbox Code Playgroud)
使用上面的加载选项
$ ccl --load test.lisp --eval '(quit)'
Hello World
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
4839 次 |
最近记录: |