Re: sharp-back syntax
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Sat, 31 Mar 2007 10:42:19 -0400
In article <1175308121.426059.83610@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
nallen05@xxxxxxxxx wrote:
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))
ah, right. thanks for pointing that out.
(defun sharp-back-expand (form)
(let (vs)
(labels ((rfn (x)
(if (sharp-back-var-p x)
(pushnew x vs)
(when (listp x)
(unless (eql (first x) 'quote) ;
(mapc #'rfn x))))))
(rfn form)
`(lambda ,(nreverse vs) ,form))))
That's not the only place where symbols are not evaluated as variables.
#$(let (($2 1))
(+ $1 $2))
(defmacro my-quote (x) `(quote ,x))
(mapcar #$(eq $1 (my-quote $2)) '(a b $2 c))
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- Follow-Ups:
- Re: sharp-back syntax
- From: nallen05
- Re: sharp-back syntax
- References:
- sharp-back syntax
- From: nallen05
- Re: sharp-back syntax
- From: Rob Warnock
- Re: sharp-back syntax
- From: Barry Margolin
- Re: sharp-back syntax
- From: nallen05
- Re: sharp-back syntax
- From: Barry Margolin
- Re: sharp-back syntax
- From: nallen05
- sharp-back syntax
- Prev by Date: Re: specialized array slower than unspecialized?
- Next by Date: Re: specialized array slower than unspecialized?
- Previous by thread: Re: sharp-back syntax
- Next by thread: Re: sharp-back syntax
- Index(es):
Relevant Pages
|
|