"amolaggar...@gmail.com" <amolaggar...@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...
On Sat, 17 Feb 2007 04:40:05 -0800, amolaggar...@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:
(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.
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.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
nicolas.e...@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
> 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
On 17 Feb 2007 14:29:08 -0800, nicolas.e...@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.
+--------------- | - *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 <r...@rpw3.org> 627 26th Avenue <URL:http://rpw3.org/> San Mateo, CA 94403 (650)572-2607
nicolas.e...@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:
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:
"amolaggar...@gmail.com" <amolaggar...@gmail.com> writes: > 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?
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.
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 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.
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
> > 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.
> 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.