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.
7 Answers
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.
1 Comment
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.
1 Comment
Racket is a really nice Scheme implementation. Its pretty powerful. One of its introductions is developing a web server from scratch.
Comments
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.
Comments
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/
Comments
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 return0. To get the output as a string, userun-pipeline/outthe same way. You can also put racket functions in the pipeline. If you have a racket implementation ofgrepcalledmy-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.