Is it feasible to use Lisp/Scheme as a scripting language?

lisp, python, ruby, scheme, scripting

Solution

Today, using `LISP` as if it's certain that anyone would understand what language one is talking about is absurd since it hasn't been one language since the 70's or probably some time earlier too. LISP only indicates that it's fully parenthesized Polish prefix notation just like Pascal, Ruby, Python and Perl are just variations of ALGOL.

`Scheme` is a standard and `Common LISP` is a standard. Both of those are general purpose though `Common LISP` is a batteries included while `Scheme` is a minimalistic language. They are quite different in style so comparing them would be like comparing `Java` with `Python`.

Embedded LISPS

There are lots of use of `Scheme` and specialized LISP dialects as embedded languages. Emacs is the most widely used editor in the unix segment and its lisp `elisp` is the most used lisp language because of this. Image processing applpication GIMP has a `Scheme` base with extensions for image processing.

Stand alone scripts

It's possible in many `Common LISP` implementation with the standard `#!`-notation to make a script work as an executable and run it as an application. Eg. I use `CLISP` and have scripts using `#!/usr/bin/clisp -C` as first line. I also use `Scheme` the same way and in the very fast incremental compiler ikarus you use `#!/usr/bin/ikarus --r6rs-script`. `Clojure` has all power of Java libraries and you can use your own classes from it and it also can be made an application with `#!/usr/bin/env java -cp /path/to/clojure-1.2.0.jar clojure.main`

more permanent application

In `Common LISP` you can dump an image. It will be a Common Lisp binary with your code already compiled in. Many Scheme implementations has compilation to native and `Clojure` can compile to java bytecode (though it's not the most common way to do it). Still I have had experience with Ikarus sometimes interpreting faster than a compiled executable from racket, chicken and gambit so I often do my programming in `DrRacket` and running it in `ikarus` in Scheme.

Try both `Common LISP` and `Scheme` as both of them are good enough for the tasks you specified in your question. There are many free books on the subject and some are worth their price as well. You may also try `Racket` too, which is a `Scheme` deviate with lots of libraries for everyday tasks, but it's not conforming to any standard.

About productivity

I imagine you are referring to how quick you can write a certain task in a Lisp dialect. I imagine it depends on how used you are to the syntax. It takes a while to get used to it after only knowing Algol dialects. It takes different approaches as well as you need to think in a more functional manner, especially for `Scheme`. I imagine when you are as good in Scheme as in your favorite Algol dialect it will be similar. Eg. some algol dialects are faster to prototype inn than others and that is true for Lisp dialects as well.

Problem

Is it feasible to script in a Lisp, as opposed to Ruby/Python/Perl/(insert accepted scripting language)? By this I mean do things like file processing (open a text file, count the number of words, return the nth line), string processing (reverse, split, slice, remove punctuation), prototyping/quick computations, and other things you would normally use Python, etc. for. How productive would doing such tasks in a Lisp be, as opposed to Ruby/Python/Perl/scripting language of choice? I ask because I want to learn a Lisp but also use it to do something instead of only learning it for the sake of it. I looked around, but couldn't find much information about scripting in a Lisp. If it is feasible, what would be a good implementation? Thank you!

Original source

Related problems