Why Lisp is Now an Acceptable Scripting Language

Faré fahree at gmail.com
Sun Mar 2 22:56:16 UTC 2014


My cl-launch demo:

cl -sp lisp-stripper -i '(print-loc-count "asdf.lisp")'

Source code for lispwc:
#!/usr/bin/cl -sp lisp-stripper -E main
(defun main (argv)
  (if argv
      (map () 'print-loc-count argv)
      (print-loc-count *standard-input*)))

And of course:
for l in sbcl ccl clisp cmucl ecl abcl \
         scl allegro lispworks gcl xcl ; do
 cl-launch -l $l -i \
 '(format t "'$l': ~S~%" `#5(1 ,@`(2 3)))' \
 2>&1 | grep "^$l:" # LW, GCL are verbose
done

Backstory:

After recent exposure to Python at work, I grew an intense dislike for
that language, and realized that I could do everything in CL instead,
and that the remaining stumbling blocks to using CL as a "scripting
language" were quite small — just missing the ability to put
#!/usr/bin/cl in a script, and there you go.

And so, I added just this capability to cl-launch, improved it to have
some of the features of buildapp, and made sure it works without a
hitch on each of the 11 implementations with a command-line interface.
This in turn requires updating ASDF and UIOP, and so here we are with
ASDF 3.1.0.86.

Then, I found that I had to take the word out, and started editing
that way a paper that I'm preparing a paper for ELS 2014 (or else ILC
2014):
      ASDF3, or Why Lisp is Now an Acceptable Scripting Language

It's incredible how having to explain the code forces you to make it
actually simpler to use. Hence new option -sp in cl-launch, to load
a system and change the current package, all in one go. Hence also
having cl-launch build software with a sequence of --system --load --eval
instead of a single setup file and toplevel system like before:
people already understand a sequence of build commands.

Also new in ASDF3: command line argument support was improved with a
LispWorks workaround and a new argv0 function; with-input and
with-output accept pathnames as designating a file to open; the bundle
support was much improved and cleaned up; the upgrade mechanism was
slightly improved to cope with the class refactoring; bugs were found
and removed in pathname functions; a weird bug in SCL was worked
around.

Enjoy!

TODO: I'm considering modifying the default behavior of cl-launch to
launch a REPL and/or read commands from stdin, like a Unix shell does
when given no script and no commands to run. I'm reserving that for
another round of procrastination.

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
To have a right to do a thing is not at all the same
as to be right in doing it.     — G.K. Chesterton



More information about the pro mailing list