From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Ryde Newsgroups: gmane.emacs.bugs Subject: bug#6596: 23.2; cl.texi docs loop destructuring for alist Date: Sat, 10 Jul 2010 09:44:21 +1000 Message-ID: <87r5jci5ka.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1278720641 4576 80.91.229.12 (10 Jul 2010 00:10:41 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Jul 2010 00:10:41 +0000 (UTC) To: 6596@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jul 10 02:10:40 2010 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1OXNeS-0006NK-15 for geb-bug-gnu-emacs@m.gmane.org; Sat, 10 Jul 2010 02:10:40 +0200 Original-Received: from localhost ([127.0.0.1]:38521 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNeR-00061f-8W for geb-bug-gnu-emacs@m.gmane.org; Fri, 09 Jul 2010 20:10:39 -0400 Original-Received: from [140.186.70.92] (port=43988 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNdp-0005fC-RY for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:10:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXNU9-0004pF-CH for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:00:02 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39255) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNU9-0004oM-6w for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 20:00:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OXNFe-000099-G6; Fri, 09 Jul 2010 19:45:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Kevin Ryde Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 09 Jul 2010 23:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 6596 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1278719087539 (code B ref -1); Fri, 09 Jul 2010 23:45:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 9 Jul 2010 23:44:47 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNFO-00008e-CO for submit@debbugs.gnu.org; Fri, 09 Jul 2010 19:44:46 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNFM-00008Z-3d for submit@debbugs.gnu.org; Fri, 09 Jul 2010 19:44:45 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:36935) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OXNFI-0002lp-Bb for submit@debbugs.gnu.org; Fri, 09 Jul 2010 19:44:40 -0400 Original-Received: from [140.186.70.92] (port=48654 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OXNFG-0001mm-KR for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 19:44:39 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OXNFE-0003Dc-2L for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 19:44:38 -0400 Original-Received: from mailout2-6.pacific.net.au ([61.8.2.229]:60562 helo=mailout2.pacific.net.au) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OXNFD-0003Cw-FR for bug-gnu-emacs@gnu.org; Fri, 09 Jul 2010 19:44:36 -0400 Original-Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.2.162]) by mailout2.pacific.net.au (Postfix) with ESMTP id 12EA422857F for ; Sat, 10 Jul 2010 09:44:30 +1000 (EST) Original-Received: from blah.blah (ppp2CED.dyn.pacific.net.au [61.8.44.237]) by mailproxy1.pacific.net.au (Postfix) with ESMTP id 40F988C03 for ; Sat, 10 Jul 2010 09:44:29 +1000 (EST) Original-Received: from gg by blah.blah with local (Exim 4.72) (envelope-from ) id 1OXNEz-0005ZH-Do for bug-gnu-emacs@gnu.org; Sat, 10 Jul 2010 09:44:21 +1000 User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Fri, 09 Jul 2010 19:45:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:38327 Archived-At: --=-=-= I didn't immediately realize the cl `loop' macro destructuring could be used to crunch an alist. Perhaps an example in the manual per below. If you're not a cl programmer you need lots of examples to understand that huge `loop' thing :-). 2010-07-10 Kevin Ryde * cl.texi (For Clauses): Add destructuring example processing an alist. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=cl.texi.loop-alist.diff --- cl.texi.orig 2010-07-10 09:37:14.000000000 +1000 +++ cl.texi 2010-07-10 09:38:54.000000000 +1000 @@ -2599,7 +2599,14 @@ than values the trailing variables get the value @code{nil}. If @code{nil} is used as a variable name, the corresponding values are ignored. Destructuring may be nested, and dotted -lists of variables like @code{(x . y)} are allowed. +lists of variables like @code{(x . y)} are allowed, so for example +to process an alist + +@example +(loop for (key . value) in '((a . 1) (b . 2)) + collect value) + @result{} (1 2) +@end example @node Iteration Clauses, Accumulation Clauses, For Clauses, Loop Facility @subsection Iteration Clauses --=-=-= In GNU Emacs 23.2.1 (i486-pc-linux-gnu, GTK+ Version 2.20.0) of 2010-05-16 on raven, modified by Debian configured using `configure '--build' 'i486-linux-gnu' '--build' 'i486-linux-gnu' '--prefix=/usr' '--sharedstatedir=/var/lib' '--libexecdir=/usr/lib' '--localstatedir=/var/lib' '--infodir=/usr/share/info' '--mandir=/usr/share/man' '--with-pop=yes' '--enable-locallisppath=/etc/emacs23:/etc/emacs:/usr/local/share/emacs/23.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/23.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/23.2/leim' '--with-x=yes' '--with-x-toolkit=gtk' '--with-toolkit-scroll-bars' 'build_alias=i486-linux-gnu' 'CFLAGS=-DDEBIAN -g -O2' 'LDFLAGS=-g' 'CPPFLAGS='' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: en_AU value of $XMODIFIERS: nil locale-coding-system: iso-latin-1-unix default enable-multibyte-characters: t --=-=-=--