From: goose
Subject: Writing Lisp programs for unix
Date: 
Message-ID: <dfvdun$4og$1@ctb-nnrp2.saix.net>
Hello all

I'm using gnu clisp on linux. I am currently using it from
the REPL only (still learning, sadly). If I wanted to write
a full application, are there any better methods than the
following:

---example file.lisp---
#!/usr/bin/clisp

(print *args*)
---end file.lisp---

This seems to work as expected, although since I am all very
new to this, I do not know whether it is good form to do
this.

Thanks in advance

L. K. Manickum

(ps. please excuse typos in my posts, I seem to have
fractured a finger today).

From: Pascal Bourguignon
Subject: Re: Writing Lisp programs for unix
Date: 
Message-ID: <87d5ng8wqb.fsf@thalassa.informatimago.com>
goose <····@webmail.co.za> writes:

> Hello all
>
> I'm using gnu clisp on linux. I am currently using it from
> the REPL only (still learning, sadly). If I wanted to write
> a full application, are there any better methods than the
> following:
>
> ---example file.lisp---
> #!/usr/bin/clisp
>
> (print *args*)
> ---end file.lisp---
>
> This seems to work as expected, although since I am all very
> new to this, I do not know whether it is good form to do
> this.

For an application, you may want to use:

  #!/usr/bin/clisp -ansi -C

to get it compiled before running.


An alternative, when you've got a lot of libraries to load and
compile, is to generate an image.

(asdf:operate 'asdf:load-op :library1)
(asdf:operate 'asdf:load-op :library2)
(asdf:operate 'asdf:load-op :library3)
(load (compile-file "myfile1.lisp"))
(load (compile-file "myfile2.lisp"))
(load (compile-file "myfile3.lisp"))
(ext:saveinitmem
   "myapp.mem"
   :quiet t
   :verbose nil
   :init-function (function myapp:main)
   :start-package (find-package "MYAPP"))
(ext:shell "gzip myapp.mem")

Then you launch it with:

#!/bin/sh
exec clisp -ansi -M myapp.mem.gz


-- 
"Remember, Information is not knowledge; Knowledge is not Wisdom;
Wisdom is not truth; Truth is not beauty; Beauty is not love;
Love is not music; Music is the best." -- Frank Zappa
From: Marcin 'Qrczak' Kowalczyk
Subject: Re: Writing Lisp programs for unix
Date: 
Message-ID: <87acikoabf.fsf@qrnik.zagroda>
Pascal Bourguignon <····@mouse-potato.com> writes:

> For an application, you may want to use:
>
>   #!/usr/bin/clisp -ansi -C
>
> to get it compiled before running.

You can only pass a single argument in #!, at least on Linux.

-- 
   __("<         Marcin Kowalczyk
   \__/       ······@knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/
From: GP lisper
Subject: Re: Writing Lisp programs for unix
Date: 
Message-ID: <1126419875.ecfaf9fe0e607f48482adfdf18325869@teranews>
On Sat, 10 Sep 2005 23:57:24 +0200, <······@knm.org.pl> wrote:
> Pascal Bourguignon <····@mouse-potato.com> writes:
>
>> For an application, you may want to use:
>>
>>   #!/usr/bin/clisp -ansi -C
>>
>> to get it compiled before running.
>
> You can only pass a single argument in #!, at least on Linux.

I'm pretty sure you can read the full commandline within the program,
some of the 'make FASL executable' threads on cliki do that.  Then
there are enviromental variable tricks, so there isn't a practical
limitation in linux.

I added the i686 linux misc executable ability into my kernel, poked
around a bit in the enviroment and found a simple way to have source
autoexecute if invoked at the commandline, or just load if within
slime.  CLISP might have something similar, otherwise CMUCL certainly
does.


-- 
You can always tell a really good idea by the enemies it makes.