[Top][All Lists]

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

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

From: Oleksandr Gavenko
Subject: Re: "defmacro" and "local variables" and "let" and "nconc" strange behaviour...
Date: Sun, 13 Jan 2013 17:00:40 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux)

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

Best regards!

reply via email to

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