[Hope I've untangled/attributed the quotes correctly...]
John Thingstad <jpthing@online.no> wrote:
+---------------
| > "John Thingstad" <jpthing@online.no> writes:
| >> But following Rob Warnock's £ readmacro syntax idea.
|
| Typo: should be $ readmacro.
+---------------
Actually, should be #$ readmacro. It's too minor to eat all of $.
Kent M Pitman <pitman@nhplace.com>:
+---------------
| > (mapcar λ(format "~A:~A" λ1 λ2) list)
| Here, by contrast, I see lambdas.
+---------------
I don't, I just see weird two- or three- characters sequences.
Must be some UTF-8 or ISO-8859 thingies I can't see.
But here's a really twisted one for those with "dumb" terminals:
Instead of using FN to abbreviate LAMBDA, we can use /. which
kinda looks like a lambda is you squint: ;-}
> (defmacro /. (args &body body) `(lambda ,args ,@body))
/.
> (mapcar (/. (x) (* 3 x)) (iota 5))
(0 3 6 9 12)
>
Kent M Pitman <pitman@nhplace.com> asked:
+---------------
| But I'm curious: how does the nesting of this macro work? What does
| (lambda (x)
| (lambda (y z)
| (f x y z)))
| look like in this shorthand format?
+---------------
With /. it's easy:
(/. (x)
(/. (y z)
(f x y z)))
but of course with #$ you can't do it without introducing
a renaming variable [just like with nested shell functions]:
#$(let ((x $1))
#$(f x $1 $2))
But how often do you need to type that at the REPL? ...which is
where #$ was intended to be used, *NOT EVER* in coding source files!
-Rob
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607