Moritz' webpage/ blog/ posts/ clisp

I'm experimenting with compiling Lisp code to executables ready for delivery. This is how it works with CLisp:

Example code, save it in "echo.lisp":

(defun echo (args)
  (map nil
       (lambda (s)
         (format t "~a " s))
       args))

(defun main ()
  (echo ext:*args*)
  (ext:exit 0))

Then execute:

$ clisp -i echo.lisp -x "(ext:saveinitmem \"echo\" :init-function 'main :executable t :quiet t)"

This will compile the code into a executable file "echo". Works:

$ ./echo foo bar
foo bar 
$

I wonder what would be a good way to have a "standard" mechanism for all the free Lisps for compiling code. Maybe one could construct a wrapper mechanism... something like:

$ make-lisp-exec --mode {clisp,sbcl,gcl,...} --output echo echo.lisp

Hmm.

Tags: tech