Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Separate the lisp environment from the shell (and other things)

1 view
Skip to first unread message

Rares Marian

unread,
May 26, 2008, 12:32:16 AM5/26/08
to
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.

Lars Rune Nøstdal

unread,
May 26, 2008, 2:23:36 AM5/26/08
to

..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/

Pascal J. Bourguignon

unread,
May 26, 2008, 5:19:32 AM5/26/08
to
Rares Marian <rares....@gmail.com> writes:

chsh /usr/bin/clisp

Have a lookt at: http://clisp.cons.org/clash.html

--
__Pascal Bourguignon__

Rob Warnock

unread,
May 26, 2008, 5:23:15 AM5/26/08
to
Rares Marian <rares....@gmail.com> wrote:
+---------------

| We should be at a point where we can start lisp programs
| from the shell or desktop just like any other binary.
+---------------

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

Peter Hildebrandt

unread,
May 26, 2008, 8:06:25 AM5/26/08
to
Rob Warnock wrote:
> Rares Marian <rares....@gmail.com> wrote:
> +---------------
> | We should be at a point where we can start lisp programs
> | from the shell or desktop just like any other binary.
> +---------------
>
> Been there, done that, years & years ago. Works just fine:

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

Tim Bradshaw

unread,
May 26, 2008, 11:04:19 AM5/26/08
to
On May 26, 5:32 am, Rares Marian <rares.mar...@gmail.com> wrote:
> We should be at a point where we can start lisp programs from the shell
> or desktop just like any other binary.

We've been able to do that for years and years.

stassats

unread,
May 26, 2008, 11:16:20 AM5/26/08
to

You can setup binfmt_misc in Linux for excuting fasls.

Evans Winner

unread,
May 26, 2008, 7:20:30 PM5/26/08
to
Lars Rune Nøstdal <larsn...@gmail.com> writes:

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.

koodailar

unread,
May 28, 2008, 6:52:40 AM5/28/08
to
On May 26, 8:06 pm, Peter Hildebrandt <peter.hildebra...@gmail.com>
wrote:
> Rob Warnock wrote:
> > Rob Warnock <r...@rpw3.org>

> > 627 26th Avenue <URL:http://rpw3.org/>
> > San Mateo, CA 94403 (650)572-2607
Do you know how to remove the "This is SBCL 1.0....."?

Peter Hildebrandt

unread,
May 28, 2008, 10:55:01 AM5/28/08
to
koodailar wrote:
> Do you know how to remove the "This is SBCL 1.0....."?

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

0 new messages