Subject: Lisp programs as stand-alone Unix executables

From: haible (Bruno Haible)
Date: Fri, 7 Apr 95 15:53:44 +0200

In ma2s2.mathematik.uni-karlsruhe.de:/pub/lisp/clisp/contrib/clispsh.tar.z
you can find a small package which allows turning CLISP programs into
normal Unix executables. Useful for using Lisp as a "scripting language".

This package requires clisp-1995-04-04 or newer.

For example, a filter which reverses the characters in every line can be
written like this:

========================= line-reverse ======================
#!/usr/local/bin/clispsh
(defun process-file (istream ostream)
  (let ((eof "EOF"))
    (loop for line = (read-line istream nil eof)
          do (when (eq line eof) (return))
             (write-line (reverse line) ostream)
) ) )
(process-file *standard-input* *standard-output*)
=============================================================
chmod a+x line-reverse
----------------------
makes this a valid Unix executable.

The command-line arguments are passed in a variable *ARGS*, as a list of
strings. For example, a program which prints its arguments is
============= args ==============
#!/usr/local/bin/clispsh
(format t "args = ~:S~%" *args*)
=================================

Author: Bruno Haible <[email-masked]>
Copyright policy: GNU GPL

---

From: [email-masked] (Peter Dudey Drake)
Date: Fri, 7 Apr 95 09:10:43 PDT

Now, just out of curiosity, what if the program being made into an
executable contains calls to EVAL and FUNCALL?  Does this just result
in a really big executable?

+-     PETER DUDEY DRAKE      279-D SE Lilly Ave.,  Corvallis, OR  97333     -+
|       MS student in Artificial Intelligence, Oregon State University        |
|   "Wow!  That was so cool, Rizzo!  I've never been pulled through a block   |
|   and tackle before!"                                         -- Gonzo      |
+-  [email-masked]        (finger [email-masked])  -+