Subject: LAMBDA abbreviations [was: ...Scheme is not a Lisp]
From: rpw3@rpw3.org (Rob Warnock)
Date: Tue, 09 Sep 2003 04:43:51 -0500
Newsgroups: comp.lang.lisp
Message-ID: <TkKdnV4QS6BKPcCiXTWc-g@speakeasy.net>
Kent M Pitman  <pitman@world.std.com> wrote:
+---------------
| Consider:
|  (lambda (1 2) (+ (var 1) (var 2)))
| or
|  (lambda ((thing 1) (thing 2))
|    (+ (var (thing 1)) (var (thing 2))))
+---------------

Heh! Funny you should mention. The most successful (so far) of
my many attempts at coming up with a usable reader macro shorthand
for LAMBDA provides implicitly-declared parameters with names of
$1, $2, &c., like a shell script. [The choice of "#$" as the reader
macro is supposed to be a reminder of that.] It's too ugly and
non-standard for code you might ever want to release to others,
but on the other hand it's sometimes kinda convenient if you're
just messing around interactively:

    > (mapcar #$(* $1 3) '(1 8 4 2))
    (3 24 12 6)
    > (mapcar #$(cons $2 (1+ $1)) '(1 8 4 2) '(bill joe sally ted))
    ((BILL . 2) (JOE . 9) (SALLY . 5) (TED . 3))
    > (remove-if #$(char= #\L (char (symbol-name $1) 2))
		 '(bill joe sally ted))
    (JOE TED)
    >


-Rob

p.s. Another flavor I tried, but never found as convenient
[since you still have to type the whole parameter list] was:

    > (mapcar #[(x y) (cons y (1+ x))] '(1 8 4 2) '(bill joe sally ted))
    ((BILL . 2) (JOE . 9) (SALLY . 5) (TED . 3))
    > 

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