对于 unix 脚本来说,最好的 lisp/scheme 是什么?
标题几乎说明了一切。我在我的主要项目中使用 clojure,但它不是一个好的脚本语言,因为 jvm 的启动速度很慢,并且与一些 unixy 的东西不能很好地交互。所以我正在寻找一种能够很好地作为脚本语言使用的 lisp,例如具有良好的界面来管理 unix 进程,轻松使用 async io 等。
The title pretty much says it all. I use clojure for my major projects but it's not a good scripting language because the jvm has a slow startup and doesn't interface well with some unixy things. So I'm looking for a lisp which will work well as a scripting language, for example having a good interface for managing unix processes, easily use things like async io, etc.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
Scsh(它代表“Scheme shell”)可以从 http://www.scsh.net 获取。它是“Scheme 48(符合 R5RS 的新技术Scheme 系统)的一个变体……专为编写现实生活中的独立 Unix 程序和 shell 脚本而设计。”
关于系统管理的精彩介绍可以在 http://www .theillien.com/Sys_Admin_v12/html/v11/i01/a2.htm。
Scsh (it stands for "Scheme shell") can be gotten at http://www.scsh.net. It's "a variant of Scheme 48 (an R5RS compliant new-tech Scheme system) ... designed for writing real-life standalone Unix programs and shell scripts."
A nice introduction to system administration in it can be found at http://www.theillien.com/Sys_Admin_v12/html/v11/i01/a2.htm.
许多常见的 UNIX 工具都具有 Guile 的绑定。如果您的目标是自动化这些工具中的任何一个,那么这可能是一个不错的选择。
A wide range of common unix tools have bindings for Guile. If its your objective to automate any of these tools, this might be a nice place to look.
Racket 是一个非常好的Scheme 实现。它相当强大。其介绍之一是从头开始开发 Web 服务器。
Racket is a really nice Scheme implementation. Its pretty powerful. One of its introductions is developing a web server from scratch.
CLISP 是 Common Lisp 的一种实现,对于 Unix 脚本编写非常有用。
CLISP 有许多扩展,使其对于脚本编写非常有用:Unicode 支持、正则表达式、各种命令行选项、套接字流、管道……
此外,CLISP 占用空间相对较小,采用 C 语言编写,具有可移植性,并且启动速度快 - 对于通用 Lisp。
CLISP, an implementation of Common Lisp, is useful for Unix scripting.
CLISP has many extensions that make it useful for scripting: Unicode support, regular expressions, various command line options, socket streams, piping, ...
Additionally CLISP has a relatively small footprint, is written in C for portability and starts fast - for a Common Lisp.
Eshell 与 Elisp 用于交互使用:
“Eshell 能够调用 Emacs 中加载的几乎所有 elisp 函数。这种灵活性是无与伦比的;没有任何 shell 能够近似 Eshell 的功能。事实上,此功能被大量使用(并鼓励!)如果您想在 Emacs 中打开文件 foobar.txt,您只需调用 find-file foobar.txt,Eshell 会将其映射到 elisp 调用(find-file "foobar.txt")并打开给你的文件。”
来自 http://www.masteringemacs.org/articles /2010/12/13/complete-guide-mastering-eshell/
Eshell with Elisp for interactive use:
"Eshell is capable of invoking almost any elisp function loaded in Emacs. That sort of flexibility is unmatched; there are no shells out there capable of approximating what Eshell can do. In fact, this functionality is heavily used (and encouraged!) by Eshell. If you want to open the file foobar.txt in Emacs you simply invoke find-file foobar.txt and Eshell will map that to the elisp call (find-file "foobar.txt") and open the file for you."
from http://www.masteringemacs.org/articles/2010/12/13/complete-guide-mastering-eshell/
我在寻找一种好方法将一些日益笨拙的 bash 脚本移植为更清晰的语言时遇到了几次这个页面。由于这些脚本已经调用了一些 Racket 脚本,因此删除间接层并使用 Racket 处理所有事情是有意义的。
经过一番搜索,我发现了 Racket 的 shell-pipeline 包。从文档中:
I ran into this page a few times while looking for a nice way to port some increasingly-unweildy bash scripts into a saner language. Since these scripts were already invoking a few Racket scripts, it made sense to remove a layer of indirection and use Racket for everything.
After some searching, I came across the shell-pipeline package for Racket. From the documentation: