help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "defmacro" and "local variables" and "let" and "nconc" strange behav


From: Le Wang
Subject: Re: "defmacro" and "local variables" and "let" and "nconc" strange behaviour...
Date: Mon, 14 Jan 2013 00:45:38 +0800

On Sun, Jan 13, 2013 at 11:00 PM, Oleksandr Gavenko <address@hidden> wrote:
> On 2013-01-13, Barry Margolin wrote:
>
>> In article <address@hidden>,
>>  Oleksandr Gavenko <address@hidden> wrote:
>>
>>> I wrote simple macro:
>>>
>>>   (defmacro my-filter (pred list)
>>>     "Construct list with elements from LIST which satisfy PRED."
>>>     (let ( (r (make-symbol "r_")) )
>>>       `(let ( (,r '(nil)) )
>>>          (mapc (lambda (item)
>>>                  (when (,pred item)
>>>                    (nconc ,r (cons item nil))))
>>>                ,list)
>>>          (cdr ,r))))
>>> [...]
>>> Why instead of '(nil) I get something else?
>>
>> Because nconc is destructively modifying its own source code.
>
> I know that nconc destructive. But how this effect '(nil) in defmacro inside
> `(...)?

In lisp, code is data.  See my enlightenment process:
http://comments.gmane.org/gmane.emacs.bugs/50783

-- 
Le



reply via email to

[Prev in Thread] Current Thread [Next in Thread]