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.
Rares Marian <············@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 <····@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607
Rob Warnock wrote:
> Rares Marian <············@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:
·····@babyfoot:~/tmp$ cat hello.lisp
#!/usr/bin/sbcl
(print 'hello-world)
·····@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
>
> $ 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 <····@rpw3.org>
> 627 26th Avenue <URL:http://rpw3.org/>
> San Mateo, CA 94403 (650)572-2607
>
On May 26, 8:06 pm, Peter Hildebrandt <·················@gmail.com>
wrote:
> Rob Warnock wrote:
> > Rares Marian <············@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:
>
> ·····@babyfoot:~/tmp$ cat hello.lisp
> #!/usr/bin/sbcl
> (print 'hello-world)
>
> ·····@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
>
>
>
> > $ 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 <····@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....."?
·····@babyfoot:~/tmp$ cat hello.lisp
#!/usr/bin/sbcl
(print 'hello-world)
·····@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
koodailar wrote:
> Do you know how to remove the "This is SBCL 1.0....."?
·····@babyfoot:~/tmp$ cat hello.lisp
#!/usr/bin/sbcl --noinform
(print 'hello-world)
·····@babyfoot:~/tmp$ ./hello.lisp
HELLO-WORLD
http://www.sbcl.org/manual/Runtime-Options.html#Runtime-Options
HTH,
Peter
> ·····@babyfoot:~/tmp$ cat hello.lisp
> #!/usr/bin/sbcl
> (print 'hello-world)
>
> ·····@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
On May 26, 5:32 am, Rares Marian <············@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.
On May 26, 8:32 am, Rares Marian <············@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.
>
> Perhaps the environment could be a daemon with libraries that are loaded
> like modules.
>
> We need to get a way from the monolithic environment.
You can setup binfmt_misc in Linux for excuting fasls.
From: =?UTF-8?B?TGFycyBSdW5lIE7DuHN0ZGFs?=
Subject: Re: Separate the lisp environment from the shell (and other things)
Date:
Message-ID: <483a576d$0$2328$c83e3ef6@nn1-read.tele2.net>
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).
(..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/
From: Evans Winner
Subject: Re: Separate the lisp environment from the shell (and other things)
Date:
Message-ID: <86hcckhcu9.fsf@timbral.net>
Lars Rune Nøstdal <···········@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.
From: Pascal J. Bourguignon
Subject: Re: Separate the lisp environment from the shell (and other things)
Date:
Message-ID: <7clk1xh17f.fsf@pbourguignon.anevia.com>
Rares Marian <············@gmail.com> writes:
> 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.
chsh /usr/bin/clisp
Have a lookt at: http://clisp.cons.org/clash.html
--
__Pascal Bourguignon__