Subject: Re: arc tangent
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 20 Jan 2008 00:16:32 -0600
Newsgroups: comp.lang.lisp
Message-ID: <IbednTceKKHdeg_anZ2dnUVZ_vGinZ2d@speakeasy.net>
funkyj <funkyj@gmail.com> wrote:
+---------------
| As some one who works professionally in C/C++, I would like to use CL
| where I currently use Perl/Python (i.e. small utility programs and
| hobby projects) but it is currently way too hard to do these small
| programs in lisp.  I know, I know, you serious macho lisp programmers
| sneer at my desire to have a CL suitable for scripting but that is
| what I want.
| 
| scripting lisp tangent: I remember a while back seeing an
| announcement of a new lisp dialect that was intended for scripting.
+---------------

Hunh?!? Who needs a "new" Lisp dialect for scripting?!?
I use CL for "small utility programs" all the time!!
Scripting works just fine in CMUCL[1]:

    $ cat hello.cmucl
    #!/usr/local/bin/cmucl -script
    (format t "Hello, world!~%")
    (loop for arg in (cons *script-name* *script-args*)
	  and i from 0
      do (format t "argv[~a] = ~s~%" i arg))
    $ ./hello.cmucl -foo bar baz
    Hello, world!
    argv[0] = "./hello.cmucl"
    argv[1] = "-foo"
    argv[2] = "bar"
    argv[3] = "baz"
    $ 

And in CLISP:

    $ cat hello.clisp
    #!/usr/local/bin/clisp
    (format t "hello world!~%")
    (loop for arg in (cons (namestring *load-pathname*) *args*)
	  and i from 0
      do (format t "argv[~a] = ~s~%" i arg))
    $ ./hello.clisp -foo bar baz
    hello world!
    argv[0] = "hello.clisp"
    argv[1] = "-foo"
    argv[2] = "bar"
    argv[3] = "baz"
    $ 

For other implementations, see <http://www.cliki.net/ShellScripting>
or <http://www.cliki.net/cl-launch> or maybe even the program
<http://www.chez.com/emarsden/downloads/cmucl-trampoline.c>
hacked up for a non-CMUCL (since you don't really need it for
CMUCL, given [1]).

This is a non-problem.


-Rob

[1] See <http://rpw3.org/hacks/lisp/site-switch-script.lisp>
    for how to add "-script" to CMUCL without recompiling.

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607