Barry Margolin <barmar@alum.mit.edu> wrote:
+---------------
| nallen05@gmail.com wrote:
| > are you talking about mine or Rob's? Mine doesn't actually rewrite any
| > code, it just wraps it in a "(lambda list-of-implicit-lambda-vars..."
| > form so QUOTE will behave normally, so will scope...
|
| I'm talking about both versions. You have to walk through the code
| looking for the implicit lambda vars, so that you construct the lambda
| list. But if there are any quoted symbols that look like your implicit
| lambda variables you'll add them to the lambda list. E.g. I'd expect
| this:
|
| (mapcar #$(eq $1 '$2) '(a b $2 c))
|
| to generate a "wrong number of arguments" error because it will
| expand into:
|
| (mapcar #'(lambda ($1 $2) (eq $1 '$2)) '(a b $2 c))
+---------------
Nope. It [well, mine at least] expands into this:
(mapcar (lambda (&optional $1 $2 $3 $4 $5 $6 $7 $8 $9 &rest $*)
(declare (ignorable $1 $2 $3 $4 $5 $6 $7 $8 $9 $*))
(eq $1 '$2))
'(a b $2 c))
which works just fine:
> (mapcar #$(eq $1 '$2) '(a b $2 c))
(NIL NIL T NIL)
>
-Rob
p.s. Yes, I know the "$*" is handled wrong.
It's a hack, what can I say.
-----
Rob Warnock <rpw3@rpw3.org>
627 26th Avenue <URL:http://rpw3.org/>
San Mateo, CA 94403 (650)572-2607