对于 unix 脚本来说,最好的 lisp/scheme 是什么?

发布于 2024-10-02 14:31:26 字数 154 浏览 0 评论 0原文

标题几乎说明了一切。我在我的主要项目中使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

永言不败 2024-10-09 14:31:26

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.

瑾夏年华 2024-10-09 14:31:26

许多常见的 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.

我一向站在原地 2024-10-09 14:31:26

Racket 是一个非常好的Scheme 实现。它相当强大。其介绍之一是从头开始开发 Web 服务器。

Racket is a really nice Scheme implementation. Its pretty powerful. One of its introductions is developing a web server from scratch.

三人与歌 2024-10-09 14:31:26

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.

葬﹪忆之殇 2024-10-09 14:31:26

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/

萌吟 2024-10-09 14:31:26

我在寻找一种好方法将一些日益笨拙的 bash 脚本移植为更清晰的语言时遇到了几次这个页面。由于这些脚本已经调用了一些 Racket 脚本,因此删除间接层并使用 Racket 处理所有事情是有意义的。

经过一番搜索,我发现了 Racket 的 shell-pipeline 包。从文档中:

这个库使外部程序和球拍功能的unix风格管道变得容易。您可以简单地编写 (run-pipeline '(cat /etc/passwd) '(grep root) '(cut -d : -f 1)),它将打印 " root\n" 到 stdout(在 unix 系统上)并将返回 0。要以字符串形式获取输出,请以相同的方式使用 run-pipeline/out 。您还可以将球拍功能放入管道中。如果您有一个名为 my-grepgrep 球拍实现,您可以执行 (run-pipeline '(cat /etc/passwd) `(,my- grep root) '(cut -d : -f 1)) 得到相同的结果。所以你可以在Racket中编写各种过滤函数,而不是使用shell命令。

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:

This library makes unix-style pipelines of external programs and racket functions easy. You can write things as simply as (run-pipeline '(cat /etc/passwd) '(grep root) '(cut -d : -f 1)), which will print "root\n" to stdout (on unix systems) and will return 0. To get the output as a string, use run-pipeline/out the same way. You can also put racket functions in the pipeline. If you have a racket implementation of grep called my-grep, you can do (run-pipeline '(cat /etc/passwd) `(,my-grep root) '(cut -d : -f 1)) to get the same results. So you can write all sorts of filter functions in Racket rather than using shell commands.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文