From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Christian Ohler Newsgroups: gmane.emacs.devel Subject: Re: Lexical binding Date: Sun, 03 Apr 2011 22:05:51 +1000 Message-ID: <4D98629F.9070506@gnu.org> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1301846352 803 80.91.229.12 (3 Apr 2011 15:59:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 3 Apr 2011 15:59:12 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Juanma Barranquero Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Apr 03 17:59:07 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Q6Phj-0003Wo-8O for ged-emacs-devel@m.gmane.org; Sun, 03 Apr 2011 17:59:07 +0200 Original-Received: from localhost ([127.0.0.1]:37276 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6PeD-00071h-QG for ged-emacs-devel@m.gmane.org; Sun, 03 Apr 2011 11:55:29 -0400 Original-Received: from [140.186.70.92] (port=36770 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q6M4Z-0002ER-KF for emacs-devel@gnu.org; Sun, 03 Apr 2011 08:06:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q6M49-0003FR-3Y for emacs-devel@gnu.org; Sun, 03 Apr 2011 08:06:05 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:33186) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q6M48-0003FN-UQ for emacs-devel@gnu.org; Sun, 03 Apr 2011 08:06:01 -0400 Original-Received: from [113.197.106.249] (port=19750 helo=ohler-macbookpro-2.local) by fencepost.gnu.org with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1Q6M48-0002bZ-Bg; Sun, 03 Apr 2011 08:06:00 -0400 In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.10 X-Mailman-Approved-At: Sun, 03 Apr 2011 11:55:24 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:138087 Archived-At: On 3/04/11 4:57, Juanma Barranquero wrote: > The original trouble with `loop' is that, in a loop like this one, > with destructuring > > (defsubst my--bs-file-width () > (- (window-width) > (loop for (name width . rest) in bs-attributes-list > if (numberp width) sum width) > (bs--get-name-length) > 1)) > > `name' is just a placeholder (as it is rest). I'm interested just in > `width'. And there's no way to write that loop as is without warnings. In loop destructuring, you can use nil for fields that you want to ignore: (loop for (nil width . nil) in bs-attributes-list if (numberp width) sum width) If you want to keep the ignored fields named, you could do something like (loop for (name width . rest) in bs-attributes-list do (progn name rest) ; ignore if (numberp width) sum width) Christian.