Peter da Silva <peter@abbnm.com> wrote:
+---------------
| Provide a "lispscript" tool that lets you write, oh:
| awk 'BEGIN {FS=":"}; $6=="/sbin/nologin" {print $1}' /etc/passwd
| in no more than a couple of lines of code, and you'll get people using
| Lisp for casual scripting.
+---------------
I already frequently use it for casual scripting (well, Scheme, mostly).
With only a couple of new utility macros & functions, your example could
be expressed in Common Lisp as:
(with-lines-from-file (line "/etc/passwd")
(let ((fields (string-split line :fs #\:)))
(when (string= (aref fields 5) "/sbin/nologin")
(format t "~A~%" (aref fields 0))))))
But seriously, how many "one-liners" do you *actually* write anyway?
Not many. And by the time you've done coded up something that's complex
enough to be *useful*, Perl's tricky little code-compression notation
usually expands to be about the same length as any other language, and
six weeks or six months later I'd *much* rather be reading Lisp than
decoding a Perl puzzle.
-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