I am using cmucl or sbcl,clisp(sometimes) is there any way to pass
command line arguments to my program like a list of files to process
and etc.
Ignas Mikalajunas
Ignas Mikalajunas wrote:
> I am using cmucl or sbcl,clisp(sometimes) is there any way to pass
> command line arguments to my program like a list of files to process
> and etc.
extensions:*command-line-strings* (cmucl, sbcl) and ext:*args*
(clisp) contain the arguments passed on the command line.
Jeremy.
From: Nikodemus Siivola
Subject: Re: How to pass command line arguments to a lisp program ?
Date:
Message-ID: <bcarne$5u47i$2@midnight.cs.hut.fi>
Ignas Mikalajunas <······@centras.lt> wrote:
> I am using cmucl or sbcl,clisp(sometimes) is there any way to pass
> command line arguments to my program like a list of files to process
Yes, rtfm:
CMUCL
http://cvs2.cons.org/ftp-area/cmucl/doc/cmu-user/unix.html#toc213
SBCL (unofficial location)
http://www.xach.com/sbcl/doc/extensions.html#AEN702
CLISP
http://clisp.cons.org/clisp.html#opt-exec-file
Cheers,
-- Nikodemus
From: Drew McDermott
Subject: Re: How to pass command line arguments to a lisp program ?
Date:
Message-ID: <bcbijc$san$1@news.wss.yale.edu>
Ignas Mikalajunas wrote:
> I am using cmucl or sbcl,clisp(sometimes) is there any way to pass
> command line arguments to my program like a list of files to process
> and etc.
> Ignas Mikalajunas
Judging from this and your previous question, I gather that you want
Lisp programs to be called the way C programs are called. There is
another way to approach this issue that is much more natural in Lisp,
namely:
Treat Lisp as a shell.
Just crank Lisp up and leave it running. Instead of writing
$ myprog -s -f foo a1.txt a3 a14.lst
write
> (myprog '("a1.txt" a "a14.lst") :s t :f 'foo)
When 'myprog' finishes, the Lisp "shell" is still running, and you can
call other programs from it. Meanwhile, "command line" arguments have
morphed into ... ordinary, garden-variety arguments.
If you really want to be fanatic about it, you can probably dig up a
Lisp program someone wrote that allows you to use Lisp as your _only_
shell. For instance, it wouldn't be hard to define a 'pipe' macro so
you could write
> (pipe (ls b*) (grep "fribble"))
instead of
$ ls b* | grep "fribble" -
(Warning: these examples are completely meaningless; make no attempt to
assign meanings to them!)
-- Drew McDermott
Drew McDermott <··················@at.yale.dot.edu> writes:
> Ignas Mikalajunas wrote:
> > I am using cmucl or sbcl,clisp(sometimes) is there any way to pass
> > command line arguments to my program like a list of files to process
> > and etc.
> > Ignas Mikalajunas
>
> Judging from this and your previous question, I gather that you want
> Lisp programs to be called the way C programs are called. There is
> another way to approach this issue that is much more natural in Lisp,
> namely:
>
> Treat Lisp as a shell.
>
> Just crank Lisp up and leave it running. Instead of writing
>
> $ myprog -s -f foo a1.txt a3 a14.lst
>
> write
>
> > (myprog '("a1.txt" a "a14.lst") :s t :f 'foo)
>
> When 'myprog' finishes, the Lisp "shell" is still running, and you can
> call other programs from it. Meanwhile, "command line" arguments have
> morphed into ... ordinary, garden-variety arguments.
>
> If you really want to be fanatic about it, you can probably dig up a
> Lisp program someone wrote that allows you to use Lisp as your _only_
> shell. For instance, it wouldn't be hard to define a 'pipe' macro so
> you could write
>
> > (pipe (ls b*) (grep "fribble"))
>
> instead of
>
> $ ls b* | grep "fribble" -
scsh
clisp can be configured as a shell too. There's a web page somewhere
showing how you can add a syntax to easily call external programs from
clisp as a shell.
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
Do not adjust your mind, there is a fault in reality.
* Pascal Bourguignon <····@thalassa.informatimago.com>:
> clisp can be configured as a shell too. There's a web page somewhere
> showing how you can add a syntax to easily call external programs from
> clisp as a shell.
<URL:http://www.cliki.net/CLISP-Shell>
--
Dave Pearson
http://www.davep.org/lisp/