Subject: Re: TERPRI
From: rpw3@rpw3.org (Rob Warnock)
Date: Sat, 20 Mar 2004 08:33:30 -0600
Newsgroups: comp.lang.lisp
Message-ID: <-f2dndB_v-Cny8Hd3czS-w@speakeasy.net>
Thomas F. Burdick <tfb@famine.OCF.Berkeley.EDU> wrote:
+---------------
| David Steuber <david.steuber@verizon.net> writes:
| > If I had the talent and energy, I would be all over it right now.
| 
| I think it's safe to say that if you seriously intend to use Lisp for
| something, there is a segment of the Lisp community that has an
| interest in making sure there's a CL implementation up to it.  Speed
| isn't a problem.  For normal end-user applications and server
| applications, the size of the various Lisp implementations ranges from
| no problem at all, to the large end of reasonable.  CMUCL, for
| example, isn't normally used in its small-core variation, but it can be.
+---------------

Actually, for any machine less than a few years old (say, anything with
few hundred MHz CPU or better), the distributed CMUCL is plenty fast
enough for all *kinds* of simple systems utility tasks, e.g., the sorts
of things other people tend to use Perl for. For one trivial example,
a couple of days ago I was doing some micro-benchmarking of CMUCL startup
(running small "scripts" 100 times and histogramming the results), and I
needed to sum the "user" and "system" times reported by the "csh" builtin
"time" command (since the "total" time has one fewer digits of precision).
Here's what I wrote:

    #!/usr/local/bin/cmucl -script

    ;;; Script to sum the first two times in a "csh" "time" output:
    ;;;    0.046u 0.007s 0:00.06 66.6%     147+3008k 0+0io 0pf+0w

    (defun sum-u-s (line)
      (+ (read-from-string line nil nil :start 0 :end (position #\u line))
	 (read-from-string line nil nil :start (1+ (position #\space line))
					:end (position #\s line))))

    (loop for line = (read-line *standard-input* nil nil)
	  while line
      do (format t "~5,3f~%" (sum-u-s line)))

Trivial? Yes, but it's what I needed at the moment, and it was the
language I wa able to do it in fastest.

I mention this only because one of the best ways to learn Lisp is to 
simply use it whenever you can, and just watch how things go -- where
the easy parts are, where the hard parts are, and where Lisp doesn't
seem to fit at all [e.g., other parts of the micro-benchmarker used
"sh", "csh", "sort" and "uniq", because they happened to be the easiest
things to use at the time].


-Rob

p.s. I'll be writing up the cute/ugly hack I used to make that
"#!/usr/local/bin/cmucl -script" business work (something I've been
playing with off & on since the "executables" thread a while back),
and will post something "soon". Hint/teaser: It did *not* require
building a custom CMUCL core image -- it uses the released CMUCL-18e
"bin/lisp" and "lib/lisp.core".

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