From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Le Wang Newsgroups: gmane.emacs.help Subject: Re: "defmacro" and "local variables" and "let" and "nconc" strange behaviour... Date: Mon, 14 Jan 2013 00:45:38 +0800 Message-ID: References: <878v7x6sbr.fsf@gavenkoa.example.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1358095558 13703 80.91.229.3 (13 Jan 2013 16:45:58 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 13 Jan 2013 16:45:58 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Oleksandr Gavenko Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Jan 13 17:46:15 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TuQhK-0003tb-9z for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Jan 2013 17:46:14 +0100 Original-Received: from localhost ([::1]:52334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuQh4-0005xS-6Z for geh-help-gnu-emacs@m.gmane.org; Sun, 13 Jan 2013 11:45:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuQgs-0005xA-UJ for help-gnu-emacs@gnu.org; Sun, 13 Jan 2013 11:45:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TuQgl-0000Xs-Uy for help-gnu-emacs@gnu.org; Sun, 13 Jan 2013 11:45:46 -0500 Original-Received: from mail-vc0-f173.google.com ([209.85.220.173]:51675) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TuQgl-0000Xl-Pp for help-gnu-emacs@gnu.org; Sun, 13 Jan 2013 11:45:39 -0500 Original-Received: by mail-vc0-f173.google.com with SMTP id f13so2866930vcb.18 for ; Sun, 13 Jan 2013 08:45:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=s+RqZO5qVS4z/5YoorsoeV7ZPkJNLjg8DhBTBg5LX8c=; b=k3cWj9A7U2vV3mHuFTYsFbrV3cpZON3jar6Sa/RxtPND4021HpOTKMA5AgL3OgCJKp p4gmFxxX/C36/RCwp8qW8eoH9j3g0f2JllV5bGM0PxUhKMzJ34Z4b9mNgFnZC/f/hUN4 SdXzPv2ML2/ffBcneAceAsSMspseI9sD505dW2NoSW+V6KoXQvvkF7A9jm60Zatpq8Xx nwE2K2EuZgrqHDCSbsSGS3Zd+8Hi2ZK7JlpBO2fFdlV6MdQ7eRoL64OARI58QMz9u23N wWgwowQgRDkPJTLF5YOt0huagarN1lbaBowjl7/BstD2Ipfkgk/jUzhxN63Sh9hXy/Pl oFVg== Original-Received: by 10.58.147.69 with SMTP id ti5mr62793388veb.32.1358095538857; Sun, 13 Jan 2013 08:45:38 -0800 (PST) Original-Received: by 10.58.161.20 with HTTP; Sun, 13 Jan 2013 08:45:38 -0800 (PST) In-Reply-To: <878v7x6sbr.fsf@gavenkoa.example.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.220.173 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:88594 Archived-At: On Sun, Jan 13, 2013 at 11:00 PM, Oleksandr Gavenko wrote: > On 2013-01-13, Barry Margolin wrote: > >> In article , >> Oleksandr Gavenko 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