Subject: Re: Lisp as glue language?
From: rpw3@rigden.engr.sgi.com (Rob Warnock)
Date: 22 Nov 2000 05:10:48 GMT
Newsgroups: comp.lang.lisp
Message-ID: <8vfkgo$irir$1@fido.engr.sgi.com>
<adeger@my-deja.com> wrote:
+---------------
| My question: does Lisp have the ability to do many/all of the tasks
| that I currently use Perl for?
+---------------

Well, what *do* you use Perl for? No, that's not a facetious question.
The answer really does depend on what you expect from a "glue language",
or as someone else said [paraphrased], "gluing what to what?"

If you're comfortable with Perl already, and use it frequently enough
that you don't forget all the myriads of magic characters [that's *my*
main problem with Perl, b.t.w.], and only use it in "write-only" mode
so that you don't ever, *ever* have to go back and figure out what
you wrote a year or a month or a week later [that's my #2 problem
with Perl], then Perl is just fine for certain tasks. It certainly
minimizes keystrokes, *that's* for sure!

If the answer to any of those "if"s is negative, then you may find
Common Lisp (or a robust Scheme, of which there are a few) to be
more to your taste... once you get used to it.

Myself, I've written a goodly number of tiny scripts in Scheme
(Rice PLT's "MzScheme", usually), since I came to Scheme and got
used to doing that sort of stuff in it before I got exposed to CL.
Most of them are the sorts of text-bashing thingies that others
around here tend to use Perl for. Here are a few examples:

    plite	Infix dialect of Scheme, used for Tcl-like scripting.
		[*Why*? A very long story for another time...]

    =		A shell alias for "plite", mainly for quick&dirty
		command-line arithmetic (including bignums), e.g.:
		    % = '41.3*(20.7+34.2)'
		    2267.37
		    % = expt 2 100
		    1267650600228229401496703205376
		    % = map iota "'(5 2 3)"
		    ((0 1 2 3 4) (0 1) (0 1 2))
		    %

    chklog	Rummage through /usr/adm/SYSLOG & /usr/adm/oSYSLOG
		looking for unexpected or "strange" events.

    http-get	Dirt-simple command-line web tool:
		    % http-get -head http://reality.sgi.com
		    HTTP/1.1 200 OK
		    Server: Zeus/3.3
		    Date: Wed, 22 Nov 2000 04:35:27 GMT
		    Connection: close
		    Content-type: text/html
		    % 

    keto	Help with low-carb diet, e.g., what about almonds?
		[Low-carb diets suggest ketogenic ratios >1.0]
		    % keto 6 4 16
		    grams: protein 6  carb 4  fat 16
		    calories: protein 24  carb 16  fat 144  total 184
		    %calories: protein 13.0  carb 8.7  fat 78.3
		    ketogenic ratio: 1.89
		    % 

    scan	Rummage through heaps of saved email looking for matches
		more complex than "grep" can handle. [Work in progress...]

    sgi-opt	What are my SGI options worth today?  ;-}  ;-}

    stockquote	Fetch quotes from a web page, trim all the HTML and
		just show numbers (converted to decimals):
		    % stockquote SGI IBM
		    SGI = 4.0
		    IBM = 98.5
		    % 
		[This one keeps breaking as sites increasingly tart up
		their pages with more & more eye candy... (*sigh*) ]

    vq		SGI provides a GUI calendar/reminder tool called
		"vcal". The "vq" script dumps out plaintext from
		vcal's database. E.g., to see what's on for tomorrow:
		    % vq -d 22
		    One-time events:
		    (none)
		    Repeating events:
		    2000 Nov 22 13:30 (60): staff meeting
		    2000 Nov 22 15:00 (60): gmh/rpw3 1-on-1
		    2000 Nov 22 20:00 (120): ex-SGI/friends dinner
		    % 

Please note that any of those could just as easily have been written
in Common Lisp, had I started with it first instead of Scheme.


-Rob

-----
Rob Warnock, 31-2-510		rpw3@sgi.com
Network Engineering		http://reality.sgi.com/rpw3/
Silicon Graphics, Inc.		Phone: 650-933-1673
1600 Amphitheatre Pkwy.		PP-ASEL-IA
Mountain View, CA  94043