Perhaps the environment could be a daemon with libraries that are loaded
like modules.
We need to get a way from the monolithic environment.
..or just add everything to the "monolithic environment" and use
the REPL as the shell(#1).
(..a different monolithic environment..)
#1: ..add a "wrapper REPL" with custom syntax that is converted to
Lisp forms on the fly if you want.
--
Lars Rune Nøstdal
http://nostdal.org/
chsh /usr/bin/clisp
Have a lookt at: http://clisp.cons.org/clash.html
--
__Pascal Bourguignon__
Been there, done that, years & years ago. Works just fine:
$ iota 10
0 1 2 3 4 5 6 7 8 9
$ iota 10 20
20 21 22 23 24 25 26 27 28 29
$ iota 10 20 5
20 25 30 35 40 45 50 55 60 65
$ cat `which iota`
#!/usr/local/bin/cmucl -script
(defun iota (count &optional (start 0) (step 1))
(loop repeat count for i from start by step collect i))
(format t "~{~a~^ ~}~%"
(apply 'iota (mapcar #'read-from-string *script-args*)))
$
-Rob
p.s. See <http://rpw3.org/hacks/lisp/site-switch-script.lisp>
if you use CMUCL and haven't hacked your own "-script" or equiv.
-----
Rob Warnock <rp...@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
Or in SBCL:
fritz@babyfoot:~/tmp$ cat hello.lisp
#!/usr/bin/sbcl
(print 'hello-world)
fritz@babyfoot:~/tmp$ ./hello.lisp
This is SBCL 1.0.11.debian, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
HELLO-WORLD
The relevant part of ~/.sbclrc:
-------------------------------------------------------------------------
;;; If the first user-processable command-line argument is a filename,
;;; disable the debugger, load the file handling shebang-line and quit.
(let ((script (and (second *posix-argv*)
(probe-file (second *posix-argv*)))))
(when script
;; Handle shebang-line
(set-dispatch-macro-character #\# #\!
(lambda (stream char arg)
(declare (ignore char arg))
(read-line stream)))
;; Disable debugger
(setf *invoke-debugger-hook*
(lambda (condition hook)
(declare (ignore hook))
;; Uncomment to get backtraces on errors
;; (sb-debug:backtrace 20)
(format *error-output* "Error: ~A~%" condition)
(quit)))
(load script)
(terpri)
(quit)))
-------------------------------------------------------------------------
IIRC, I copied that almost literally from the SBCL manual.
If you use /usr/bin/lisp and require people to link that to their lisp
(cmucl does so by default) and write a portability layer, eg.
"trivial-command-line-args", this approach would even be portable.
HTH,
Peter
We've been able to do that for years and years.
You can setup binfmt_misc in Linux for excuting fasls.
Rares Marian wrote:
>> We should be at a point where we can start lisp programs from the
>> shell or desktop just like any other binary.
>>
>> Perhaps the environment could be a daemon with libraries that are
>> loaded like modules.
>>
>> We need to get a way from the monolithic environment.
..or just add everything to the "monolithic environment" and use
the REPL as the shell(#1).
Or allow both, and let users decide how they want to do it.
I have never played with cl-launch, but I believe launching
lisp programs from something like a bash shell is what it's
meant to achieve.
fritz@babyfoot:~/tmp$ cat hello.lisp
#!/usr/bin/sbcl --noinform
(print 'hello-world)
fritz@babyfoot:~/tmp$ ./hello.lisp
HELLO-WORLD
http://www.sbcl.org/manual/Runtime-Options.html#Runtime-Options
HTH,
Peter