windows 我怎样才能简单地“运行”lisp 文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2992925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I simply "run" lisp files
提问by AnnanFay
Python
Python
When I learned Python I installed it on windows with a nice gui installer and all .py files would automatically run in python, from the command line or explorer.
当我学习 Python 时,我使用一个不错的 gui 安装程序将它安装在 Windows 上,并且所有 .py 文件都会从命令行或资源管理器自动在 python 中运行。
I found this very intuitive and easy, because I could instantly make plain text files and run them.
我发现这非常直观和简单,因为我可以立即制作纯文本文件并运行它们。
Lisp
Lisp
I'm starting to learn lisp and have decided (from reviews) that SBCL is not a bad lisp implementation.
我开始学习 lisp 并决定(从评论中)SBCL 不是一个糟糕的 lisp 实现。
Is there a way to setup SBCL to run .lisp files as easily as with Python?
有没有办法设置 SBCL 来像使用 Python 一样轻松地运行 .lisp 文件?
Are there other lisp implementations that have this?
是否有其他 lisp 实现具有此功能?
采纳答案by Rainer Joswig
Executables
可执行文件
SBCL can save executable images, as Greg Harman mentions (see the :EXECUTABLE keyword): http://www.sbcl.org/manual/index.html#Saving-a-Core-Image
SBCL 可以保存可执行图像,正如 Greg Harman 提到的(参见 :EXECUTABLE 关键字):http://www.sbcl.org/manual/index.html#Saving-a-Core-Image
Scripts
脚本
Lisp files can be executed as scripts, see: http://www.sbcl.org/manual/#Shebang-Scripts
Lisp 文件可以作为脚本执行,参见:http: //www.sbcl.org/manual/#Shebang-Scripts
Command Line Options
命令行选项
SBCL has command line options to evaluate/load lisp code on start: http://www.sbcl.org/manual/#Command-Line-Options
SBCL 具有在启动时评估/加载 lisp 代码的命令行选项:http: //www.sbcl.org/manual/#Command-Line-Options
SLIME
粘液
SLIMEis an Emacs interface for Common Lisp. One can use SBCL via SLIME from within Emacs. Many people prefer Emacs Lisp listeners over typical shell interfaces.
SLIME是 Common Lisp 的 Emacs 接口。可以在 Emacs 中通过 SLIME 使用 SBCL。许多人更喜欢 Emacs Lisp 侦听器而不是典型的 shell 接口。
Most Common Lisp implementations have similar capabilities. For details consult their manual or ask here for specific implementations.
大多数 Common Lisp 实现都具有类似的功能。有关详细信息,请参阅他们的手册或在此处询问具体实现。
回答by AnnanFay
A few minutes ago someone replied with an answer nearing what I was looking for.
几分钟前,有人回复了一个接近我想要的答案。
The reply linked to http://www.sbcl.org/manual/Shebang-Scripts.htmlwhich was a great help in figuring out my solution. Whoever it was shouldn't have removed their answer as I was about to mark it as correct ;)
链接到http://www.sbcl.org/manual/Shebang-Scripts.html的回复对找出我的解决方案很有帮助。不管是谁,都不应该删除他们的答案,因为我正准备将其标记为正确;)
My final solution was to create a batch script that is linked through normal program file association as the program to open .lisp files (Right click file->Properties->Opens With->[Change]).
我的最终解决方案是创建一个批处理脚本,该脚本通过普通程序文件关联链接为打开 .lisp 文件的程序(右键单击文件-> 属性-> 打开方式-> [更改])。
@ECHO OFF
"C:\Program Files\Steel Bank Common Lisp.0.37\sbcl.exe" --script %1
When you double click files in explorer it executes them and when you run them in the command line it does the same.
当您在资源管理器中双击文件时,它会执行它们,当您在命令行中运行它们时,它也会执行相同的操作。
回答by G__
SBCL can save an executable core image via sb-ext:save-lisp-and-die
SBCL 可以通过sb-ext:save-lisp-and-die保存可执行的核心映像
回答by Zachary Wright
If you have already downloaded and installed the SBCL interpreter, then in order to run your programs by simply entering them into the command line you need to add the location of the interpreter to your system PATH variable, so that your machine knows where to look.
如果您已经下载并安装了 SBCL 解释器,那么为了通过简单地将程序输入到命令行中来运行您的程序,您需要将解释器的位置添加到您的系统 PATH 变量中,以便您的机器知道在哪里查找。
This is true for any language. What the Python installer did was add the location of the Python interpreter to your PATH environment variable.
对于任何语言都是如此。Python 安装程序所做的是将 Python 解释器的位置添加到您的 PATH 环境变量中。
Depending on your platform, do a quick Google search on how to set environment variables.
根据您的平台,在 Google 上快速搜索如何设置环境变量。