From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thierry Volpiatto Newsgroups: gmane.emacs.bugs Subject: bug#6583: 23.2; cl loop macro with `and' clause Date: Thu, 08 Jul 2010 09:40:22 +0200 Organization: ThierryVolpiatto Message-ID: <87hbkah15l.fsf@tux.homenetwork> References: <871vbedfzq.fsf@blah.blah> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1278576013 32475 80.91.229.12 (8 Jul 2010 08:00:13 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 8 Jul 2010 08:00:13 +0000 (UTC) To: bug-gnu-emacs@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jul 08 10:00:10 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 1OWm1h-0000WL-Tw for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Jul 2010 10:00:10 +0200 Original-Received: from localhost ([127.0.0.1]:47881 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWm1h-0004AE-4e for geb-bug-gnu-emacs@m.gmane.org; Thu, 08 Jul 2010 04:00:09 -0400 Original-Received: from [140.186.70.92] (port=47422 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWm1U-00047r-JY for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:59:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWm1T-0001cb-BH for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:59:56 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:39088) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWm1T-0001cV-90 for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:59:55 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1OWlm5-00052c-PB; Thu, 08 Jul 2010 03:44:01 -0400 X-Loop: help-debbugs@gnu.org In-Reply-To: <871vbedfzq.fsf@blah.blah> Resent-From: Thierry Volpiatto Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 08 Jul 2010 07:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6583 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by submit@debbugs.gnu.org id=B.127857501719364 (code B ref -1); Thu, 08 Jul 2010 07:44:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 8 Jul 2010 07:43:37 +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 1OWllg-00052H-FW for submit@debbugs.gnu.org; Thu, 08 Jul 2010 03:43:37 -0400 Original-Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWlle-00052A-H6 for submit@debbugs.gnu.org; Thu, 08 Jul 2010 03:43:35 -0400 Original-Received: from lists.gnu.org ([199.232.76.165]:46921) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1OWllb-000758-Lh for submit@debbugs.gnu.org; Thu, 08 Jul 2010 03:43:31 -0400 Original-Received: from [140.186.70.92] (port=45195 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OWllY-0001FB-80 for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:43:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OWllW-0007hm-Sc for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:43:28 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:60202) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OWllW-0007hB-GY for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 03:43:26 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1OWllR-00071F-RI for bug-gnu-emacs@gnu.org; Thu, 08 Jul 2010 09:43:21 +0200 Original-Received: from 22.77.197-77.rev.gaoland.net ([77.197.77.22]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Jul 2010 09:43:21 +0200 Original-Received: from thierry.volpiatto by 22.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 08 Jul 2010 09:43:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 101 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 22.77.197-77.rev.gaoland.net User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:HShS7my9ireidr6nPXe+SSJ2/5A= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) 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: Thu, 08 Jul 2010 03:44:01 -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:38297 Archived-At: Kevin Ryde writes: > Evaluating > > (require 'cl) > (loop for elem in '(1 2 3) > for k = elem and j = 99 > do > (print k)) IMHO this is not correct, 'and' clauses should be used after conditionals (e.g if, when etc..) ,---- | ELISP> (loop for elem in '(1 2 3) | for k = elem | if (oddp k) | collect k and do (print k)) `---- > shows > > 1 > 1 > 2 Instead of returning this, emacs should throw an error as SBCL does for same code. ,---- | CL-USER> (loop for i in '(1 2 3) | for k = i and j = 99 | (print k)) | ; Evaluation aborted. `---- > where I thought it might be > > 1 > 2 > 3 > > I'm don't know much about the cl loop macro but thought the `for k' step > would be evaluated after the `for elem' step, "sequential" per the cl > info manual near the end of "For Clauses" > > If you include several `for' clauses in a row, they are treated > sequentially > > The 1,2,3 is what you get from pasting the same form into clisp, if that > suggests what an actual common lisp does or should do. And in Emacs > it's had if you omit the "and j", > > (loop for elem in '(1 2 3) > for k = elem > do > (print k)) > => > 1 2 3 > > Nosing around the macro expansion I wondered if the "step" of k/j gets > mispositioned if there's an `and', but it's hard to be sure. > > > I struck this when making a loop over an alist where I thought to take > apart the key and value with an `and' as they didn't need to be > sequential, > > (loop for elem in my-alist > for k = (car elem) and v = (cdr elem) > do > ... > > Alas the effect of the "1 1 2" was to double the first element and omit > the last. > > > 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 > > > > -- Thierry Volpiatto Gpg key: http://pgp.mit.edu/