From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Pascal J. Bourguignon" Newsgroups: gmane.emacs.help Subject: Re: Evaluation of macro arguments Date: Tue, 05 Jan 2016 20:22:17 +0100 Organization: Informatimago Message-ID: <87h9irn85y.fsf@kuiper.lan.informatimago.com> References: <87fuycs35f.fsf@mbork.pl> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1452021785 23190 80.91.229.3 (5 Jan 2016 19:23:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 5 Jan 2016 19:23:05 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 05 20:22:55 2016 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 1aGXC2-0007Nv-3i for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 20:22:54 +0100 Original-Received: from localhost ([::1]:51134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXBy-0000R9-C2 for geh-help-gnu-emacs@m.gmane.org; Tue, 05 Jan 2016 14:22:50 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50843) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXBl-0000OG-7y for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 14:22:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGXBh-000653-6q for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 14:22:37 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:45718) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGXBh-00064r-0C for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 14:22:33 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1aGXBe-00073X-Kl for help-gnu-emacs@gnu.org; Tue, 05 Jan 2016 20:22:30 +0100 Original-Received: from amontsouris-654-1-38-12.w92-151.abo.wanadoo.fr ([92.151.133.12]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 20:22:30 +0100 Original-Received: from pjb by amontsouris-654-1-38-12.w92-151.abo.wanadoo.fr with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 05 Jan 2016 20:22:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: amontsouris-654-1-38-12.w92-151.abo.wanadoo.fr Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) Cancel-Lock: sha1:ZjI4YzdlMWVkYzIzOWFlNzhmNjk5ODZhMDg1MWUwNWZjMDUzMzBmOA== X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:108623 Archived-At: Marcin Borkowski writes: > Hi all, > > continuing my quest to grok macro argument evaluation issues, I'd like > (again) to make sure that I get it correctly. So I have this simple > macro generating a list of consecutive numbers (which is not without > problems - I am aware of those, namely (i) it uses hard-coded symbols > instead of generating them on the fly, and (ii) it has no error > checking): > > (defmacro range (from dir to) > `(let ((delta (cond ((eq ',dir 'upto) 1) > ((eq ',dir 'downto) -1))) > (i ,from) > (list nil)) > (while (not (= i ,to)) > (push i list) > (setq i (+ i delta))) > (nreverse list))) (let ((i 0)) (list (range i 'upto (incf i 10)) ; bam! i)) I hope you may debug it well. -- __Pascal Bourguignon__ http://www.informatimago.com/ “The factory of the future will have only two employees, a man and a dog. The man will be there to feed the dog. The dog will be there to keep the man from touching the equipment.” -- Carl Bass CEO Autodesk