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

common lisp as scripting language

1,717 views
Skip to first unread message

amolag...@gmail.com

unread,
Feb 17, 2007, 7:40:05 AM2/17/07
to
how good is cl as a scripting language? Is there any dialect of lisp
devoted specifically to scripting?

Pascal Bourguignon

unread,
Feb 17, 2007, 8:22:11 AM2/17/07
to
"amolag...@gmail.com" <amolag...@gmail.com> writes:

> how good is cl as a scripting language? Is there any dialect of lisp
> devoted specifically to scripting?

Good enough.
I've been writing all my script for several years in clisp.
It can even be used as interactive shell:
http://clisp.cons.org/clash.html


Almost all CL implementations would do equally well for scripts.
Perhaps clisp being smaller is faster and nicer for small scripts.
The point is that there's not a clear cut difference between bigger
scripts and smaller programs...


--
__Pascal Bourguignon__ http://www.informatimago.com/

"Klingon function calls do not have "parameters" -- they have
"arguments" and they ALWAYS WIN THEM."

Ken Tilton

unread,
Feb 17, 2007, 10:20:38 AM2/17/07
to

amolag...@gmail.com wrote:
> how good is cl as a scripting language?

At least as good as Tcl:

(tk-eval "pwd")
-> "C:/Program Files/acl80"

(TK-EVAL-LIST "glob a*")
-> ("acache" "acache-1.0.3" "acache-1.1.2" "acl8010.dll"
"acl8010.dllbak" "acl8010.dllbak2" "acl8010.dllbak3" "acl8010.dllbak4"
"acl8010.dllbak5" "acl8010.dllbak6" ...)

kt

--
Well, I've wrestled with reality for 35 years, Doctor, and
I'm happy to state I finally won out over it.
-- Elwood P. Dowd

In this world, you must be oh so smart or oh so pleasant.
-- Elwood's Mom

Lars Rune Nøstdal

unread,
Feb 17, 2007, 10:36:22 AM2/17/07
to
On Sat, 17 Feb 2007 04:40:05 -0800, amolag...@gmail.com wrote:

> how good is cl as a scripting language? Is there any dialect of lisp
> devoted specifically to scripting?

I use Common Lisp for everything; scripting also. For scripting tasks the
CLISP implementation of Common Lisp is suitable:

lars@ibmr52:~/programming/lisp/clisp$ cat script.lisp
#!/usr/bin/env clisp

;; http://clisp.cons.org/impnotes.html#quickstart-unix


(defun mkstr (&rest args)
(with-output-to-string (s)
(dolist (a args) (princ a s))))


(defun main ()
(princ
(mkstr "*load-truename*: " *load-truename* #\Newline
"*load-pathname*: " *load-pathname* #\Newline
"ext:*args*: " ext:*args* #\Newline))

(princ "Type in your name: ")
(format t "Your name was ~A~%" (read-line)))


(main)

lars@ibmr52:~/programming/lisp/clisp$ chmod +x script.lisp
lars@ibmr52:~/programming/lisp/clisp$ ./script.lisp this is the arguments
*load-truename*: /home/lars/programming/lisp/clisp/script.lisp
*load-pathname*: script.lisp
ext:*args*: (this is the arguments)
Type in your name: Lars
Your name was Lars
lars@ibmr52:~/programming/lisp/clisp$

You could of course use another filename extension or none at all.

--
Lars Rune Nøstdal
http://nostdal.org/

Emilio Lopes

unread,
Feb 17, 2007, 1:56:38 PM2/17/07
to
amolaggarwal@gmail com writes:

> Is there any dialect of lisp devoted specifically to scripting?

The Scheme Shell: http://www.scsh.net

--
Emílio C. Lopes
Munich, Germany

pfisk

unread,
Feb 17, 2007, 4:05:35 PM2/17/07
to

The Lisp included with Vista Smalltalk is used for client-side
scripting in Microsoft .Net and Adobe Flash 9.0 environments.

Vista Smalltalk: http://vistascript.net

nicola...@gmail.com

unread,
Feb 17, 2007, 5:29:08 PM2/17/07
to
On Feb 17, 1:40 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
wrote:

> how good is cl as a scripting language? Is there any dialect of lisp
> devoted specifically to scripting?

I decided to learn Lisp some days ago and scripting is the way i
choosed to do it. Here is my 3 days experience: Looks good for unix
scripting but:
- *standard-input* and *standard-output* may not be used as binary
streams. Since I like using a lot of small reusable scripts piped
together and feed them with any kind of data (thais is even whith
binary data), the standard IOs can't be used
- Shebang use depends on the Lisp compiler/interpreter you want to
use. For sbcl, you must use a $HOME/sbclrc file: not so easy to allow
lot of people in your Lab to use yours scripts
- As for shebang use, the way of accessing the scripts arguments is
engine dependant
- Modern scripting languages all have builtin regex functions while
Lisp has not

So it really depends of the kind of scripts you want to write and the
way you want to use/share them.
But is this the kind of scripting you think about, or do you think in
scripting as the way of providing an interface to extend an existing
application (as for the GNU Gimp program) ?

-Nicolas

Wade Humeniuk

unread,
Feb 17, 2007, 7:32:47 PM2/17/07
to
nicola...@gmail.com wrote:
> On Feb 17, 1:40 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
> wrote:
>> how good is cl as a scripting language? Is there any dialect of lisp
>> devoted specifically to scripting?
>
> I decided to learn Lisp some days ago and scripting is the way i
> choosed to do it. Here is my 3 days experience: Looks good for unix
> scripting but:
> - *standard-input* and *standard-output* may not be used as binary
> streams. Since I like using a lot of small reusable scripts piped
> together and feed them with any kind of data (thais is even whith
> binary data), the standard IOs can't be used

Not quite true. Look at MAIN in

http://shootout.alioth.debian.org/gp4/benchmark.php?test=mandelbrot&lang=sbcl&id=2

It creates a stream with a binary based stdout. Though I agree by default SBCL should
use :element-type :default for *standard-ouptut*.

Wade

Dan Bensen

unread,
Feb 17, 2007, 9:20:45 PM2/17/07
to
nicola...@gmail.com wrote:
> - Shebang use depends on the Lisp compiler/interpreter you want to
> use. For sbcl, you must use a $HOME/sbclrc file: not so easy to allow
> lot of people in your Lab to use yours scripts

The sysadmin can put it in /etc.

--
Dan
www.prairienet.org/~dsb

nicola...@gmail.com

unread,
Feb 18, 2007, 3:58:14 AM2/18/07
to
On Feb 18, 1:32 am, Wade Humeniuk <whumeniu+anti+s...@telus.net>
wrote:

> nicolas.e...@gmail.com wrote:
> > On Feb 17, 1:40 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
> > wrote:
> >> how good is cl as a scripting language? Is there any dialect of lisp
> >> devoted specifically to scripting?
>
> > I decided to learn Lisp some days ago and scripting is the way i
> > choosed to do it. Here is my 3 days experience: Looks good for unix
> > scripting but:
> > - *standard-input* and *standard-output* may not be used as binary
> > streams. Since I like using a lot of small reusable scripts piped
> > together and feed them with any kind of data (thais is even whith
> > binary data), the standard IOs can't be used
>
> Not quite true. Look at MAIN in
>
> http://shootout.alioth.debian.org/gp4/benchmark.php?test=mandelbrot&l...

>
> It creates a stream with a binary based stdout. Though I agree by default SBCL should
> use :element-type :default for *standard-ouptut*.
>
Interesting. Thanks for the tip.
-Nicolas

Giorgos Keramidas

unread,
Feb 18, 2007, 7:33:29 PM2/18/07
to
On 17 Feb 2007 14:29:08 -0800, nicola...@gmail.com wrote:
> I decided to learn Lisp some days ago and scripting is the way i
> choosed to do it. Here is my 3 days experience: Looks good for unix
> scripting but: [...]

> - Shebang use depends on the Lisp compiler/interpreter you want to
> use. For sbcl, you must use a $HOME/sbclrc file: not so easy to allow
> lot of people in your Lab to use yours scripts

This is not so bad as you make it look.

In the UNIX world we call this 'flexibility' :P

In some other environments, it may be difficult, or even impossible to
have personalized settings which do not affect the entire user base of
the same system too. In UNIX, this is not only possible, but some times
the preferred way of setting up experimental things in one's HOME
directory.

If a system-wide setting is required, the administrator of the lab can
put system-wide settings in /etc.

Chaitanya Gupta

unread,
Feb 19, 2007, 1:50:46 AM2/19/07
to
amolag...@gmail.com wrote:
> how good is cl as a scripting language? Is there any dialect of lisp
> devoted specifically to scripting?
>

Do you mean CL as a shell scripting language or as a browser/client side
scripting language?

http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/c1d33efb38b54ca6/1ca283f9fafd8a28?lnk=gst&q=regarding+common+lisp+plugin&rnum=1#1ca283f9fafd8a28


Rob Warnock

unread,
Feb 19, 2007, 5:11:19 AM2/19/07
to
<nicola...@gmail.com> wrote:
+---------------

| - *standard-input* and *standard-output* may not be used as binary
| streams. Since I like using a lot of small reusable scripts piped
| together and feed them with any kind of data (thais is even whith
| binary data), the standard IOs can't be used
+---------------

Several CL implementations support bivalent (or multivalent) streams.

In CMUCL, for example, there is a SYSTEM:BINARY-TEXT-STREAM extension
type which allows both text (e.g., READ-CHAR and things that use it)
and binary (e.g., READ-BYTE and things that use it) I/O. If the
initial *STANDARD-{IN,OUT}PUT* streams are instances of a subclass
of SYSTEM:FD-STREAM [which they almost always are], then you can
extract the Unix file descriptors and re-open them [in the Lisp
stream sense] as bivalent streams.

It's actually a bit messier than it might otherwise be in CMUCL,
since *STANDARD-OUTPUT* is actually a synonym streams to the
internal SYSTEM:*STDOUT*, and *STANDARD-INPUT* is even worse --
its a TWO-WAY-STREAM whose input & output streams are each synonym
streams to SYSTEM:*STDIN* & SYSTEM:*STDOUT*, resp., so if you
wanted to do it "cleanly" you'd have to work through all those
levels of indirection.

However, for standard Unix/Linux scripting, you already know
that stdin is fd 0 and stdout is fd 1, so what you're asking
for can be done with the following quick & dirty hack:

(setf *standard-input*
(system:make-fd-stream 0 :input t :binary-stream-p t
:element-type :default))

(setf *standard-output*
(system:make-fd-stream 1 :output t :binary-stream-p t
:element-type :default))

By the way, when opening a file from scratch, you can also use
the CMUCL OPEN extension options ":CLASS 'BINARY-TEXT-STREAM" to
get the same result. (You also need to set ":ELEMENT-TYPE :DEFAULT"
in this case too.)

+---------------


| - Modern scripting languages all have builtin regex functions while
| Lisp has not

+---------------

See <http://www.cliki.net/cl-ppcre> (and <http://www.cliki.net/text>
generally). You can load CL-PPCRE (and whatever else you want to be
"always there") into your CL, save the image, and make that one the
system default. From then on, it will "have builtin regex functions"...


-Rob

-----
Rob Warnock <rp...@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607

Duane Rettig

unread,
Feb 19, 2007, 11:11:45 AM2/19/07
to
nicola...@gmail.com writes:

> On Feb 17, 1:40 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
> wrote:
>> how good is cl as a scripting language? Is there any dialect of lisp
>> devoted specifically to scripting?
>
> I decided to learn Lisp some days ago and scripting is the way i
> choosed to do it. Here is my 3 days experience: Looks good for unix
> scripting but:
> - *standard-input* and *standard-output* may not be used as binary
> streams. Since I like using a lot of small reusable scripts piped
> together and feed them with any kind of data (thais is even whith
> binary data), the standard IOs can't be used

It's true that they can't be used portably, but many Common Lisps have
what are called "bivalent" streams, which allows them to be interpreted
either as text or as binary (i.e. read-char and read-byte both work).
Allegro CL has had these since version 5.0.1 (late 90s). See the
short description in
http://www.franz.com/support/documentation/8.0/doc/streams.htm


> - Shebang use depends on the Lisp compiler/interpreter you want to
> use. For sbcl, you must use a $HOME/sbclrc file: not so easy to allow
> lot of people in your Lab to use yours scripts

I assume by this that you mean the #! at the beginning of the *nix
scripts. I don't know about sbcl, but it's pretty straighforward in
Allegro CL:

http://www.franz.com/support/documentation/8.0/doc/startup.htm#starting-unix-script-3

Note however that some of the differences in scripting on different
operating systems is due to the systems themselves, which can hardly
be blamed on the Lisps.

> - As for shebang use, the way of accessing the scripts arguments is
> engine dependant

Yes, that is the case, but why is that a problem? I see references in
scripts consistently which start "#! /bin/sh...", as well
as "# /bin/csh...", and "#! /bin/bash..." all the time. And the fact
that sites which have multiple Common Lisp implementations runnable
tend to ensure that the names of these lisps are all different make it
not a big problem. You want portability in the CL implementations,
where the Common Lisp spec doesn't even define an exit/quit function,
because it was never intended to necessarily be quit-able? Well,
perhaps the CL spec is deficient for that reason, but how would you
expect portability in such a language when you can't even get
portability in *nix shell languages, which were _intended_ to each be
able to run on *nix systems?

[I know that this is a weak argument because different shells are
generally considered to be different languages, and CL is one language
with different implementations. However, expectations about what one
can do with CL in an environment already fraught with dependencies
must be mitigated by the realities of those environments.]

> - Modern scripting languages all have builtin regex functions while
> Lisp has not

Again, not portable, but yes, Allegro CL has _two_ versions of regexp
packages:

http://www.franz.com/support/documentation/8.0/doc/operators/excl/match-regexp.htm
http://www.franz.com/support/documentation/8.0/doc/operators/excl/match-re.htm

--
Duane Rettig du...@franz.com Franz Inc. http://www.franz.com/
555 12th St., Suite 1450 http://www.555citycenter.com/
Oakland, Ca. 94607 Phone: (510) 452-2000; Fax: (510) 452-0182

amolag...@gmail.com

unread,
Feb 19, 2007, 2:12:12 PM2/19/07
to
On Feb 19, 11:50 am, Chaitanya Gupta <m...@chaitanyagupta.com> wrote:

> amolaggar...@gmail.com wrote:
> > how good is cl as a scripting language? Is there any dialect of lisp
> > devoted specifically to scripting?
>
> Do you mean CL as a shell scripting language or as a browser/client side
> scripting language?
>
> http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/c1d33...

Pascal Bourguignon

unread,
Feb 19, 2007, 2:18:34 PM2/19/07
to
"amolag...@gmail.com" <amolag...@gmail.com> writes:

Well, since AFAIK it has never been done (well there may be an
implementation of scheme in JavaScript somewhere, but I don't think
it's used much), how can we know how good it would be.

IMO, it would be quite good. But notice how few java applets there
are out there. Would there be more lisp applets?


Otherwise, yes, there are several lisp dialects (or implementations)
devoted to scripting. For example guile. But I'd rather advise you
to consider a Common Lisp implementation like ECL that's designed to
be easily integratable into applications to be used as their scripting
programming language.

pfisk

unread,
Feb 19, 2007, 4:53:52 PM2/19/07
to
On Feb 19, 2:12 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
wrote:

Here is an example of a Lisp for Flash 9 which runs in most browsers
on Windows, Macintosh, and Linux. I will be adding animations over the
next few days.

Here is the Lisp code:
http://vistascript.net/vistascript/docuwiki/doku.php?id=libraries:lisp:flash

Open the environment in your browser:
http://vistascript.net/vistascript/flex/vst.swf

The main site:
http://vistascript.net/vistascript/docuwiki/doku.php

Lisp blog entries:
http://vistasmalltalk.wordpress.com/tag/lisp/


kent...@gmail.com

unread,
Feb 19, 2007, 11:30:27 PM2/19/07
to

pfisk wrote:

Well that looks relatively awesome.

How are you finding Flash as a general purpose graphics platform? Some
obvious huge advantages, any downsides? Fine control of text/fonts/
antiliasing-a/positioning?

Also, GPL only, or are other licensing schemes available?

pfisk

unread,
Feb 20, 2007, 9:21:10 AM2/20/07
to
On Feb 19, 11:30 pm, kentil...@gmail.com wrote:
> pfisk wrote:
> > On Feb 19, 2:12 pm, "amolaggar...@gmail.com" <amolaggar...@gmail.com>
> > wrote:
>
> >> On Feb 19, 11:50 am, Chaitanya Gupta <m...@chaitanyagupta.com> wrote:
>
> >>> amolaggar...@gmail.com wrote:
>
> >>>> how good is cl as a scripting language? Is there any dialect of lisp
> >>>> devoted specifically to scripting?
>
> >>> Do you mean CL as a shell scripting language or as a browser/client side
> >>> scripting language?
>
> >>>http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/c1d33...
>
> >> as a browser/client side scripting language
>
> > Here is an example of a Lisp for Flash 9 which runs in most browsers
> > on Windows, Macintosh, and Linux. I will be adding animations over the
> > next few days.
>
> > Here is the Lisp code:
> >http://vistascript.net/vistascript/docuwiki/doku.php?id=libraries:lis...

>
> > Open the environment in your browser:
> >http://vistascript.net/vistascript/flex/vst.swf
>
> > The main site:
> >http://vistascript.net/vistascript/docuwiki/doku.php
>
> > Lisp blog entries:
> >http://vistasmalltalk.wordpress.com/tag/lisp/
>
> Well that looks relatively awesome.
>
> How are you finding Flash as a general purpose graphics platform? Some
> obvious huge advantages, any downsides? Fine control of text/fonts/
> antiliasing-a/positioning?
>
> Also, GPL only, or are other licensing schemes available?
>
> kt
>
> --
> Well, I've wrestled with reality for 35 years, Doctor, and
> I'm happy to state I finally won out over it.
> -- Elwood P. Dowd
>
> In this world, you must be oh so smart or oh so pleasant.
> -- Elwood's Mom- Hide quoted text -
>
> - Show quoted text -

1) The interpreter is running on both .Net and Flash. Flash runs on
more platforms but text and graphics rendering are better in .Net -
there is a post in my blog comparing the two. The goal is to be able
to write scripts that can run unchanged across desktop (Windows Vista
or Adobe Apollo) and browser (WPF/e or Flash) environments.

2) The GPL applies only to the Lisp code - it may be changed to public
domain. The interpreter is free but closed source - full source code
will be available for purchase in March/April.

3) Most of the interpreter hasn't been ported to Flash yet - it will
support Lisp packages and macros when it is completed.

Faré

unread,
Jun 17, 2015, 11:19:40 AM6/17/15
to
On Saturday, February 17, 2007 at 7:40:05 AM UTC-5, amolag...@gmail.com wrote:
> how good is cl as a scripting language? Is there any dialect of lisp
> devoted specifically to scripting?

Since this thread appears high while looking for "Common Lisp as Scripting Language", let me note, a few years laters, that nowadays, YES, Common Lisp is a semi-decent scripting language. See my article "Common Lisp as a Scripting Language, 2015 edition"
http://fare.livejournal.com/184127.html

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Any time you're asking the user to make a choice they don't care about,
you have failed the user — Jeff Atwood
0 new messages