Lars Ingebrigtsen <larsi@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 6583) by debbugs.gnu.org; 14 Sep 2020 13:10:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 14 09:10:29 2020
Received: from localhost ([127.0.0.1]:53069 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1kHoFZ-0004kZ-4j
for submit <at> debbugs.gnu.org; Mon, 14 Sep 2020 09:10:29 -0400
Received: from quimby.gnus.org ([95.216.78.240]:58654)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <larsi@HIDDEN>) id 1kHoFY-0004kN-5U
for 6583 <at> debbugs.gnu.org; Mon, 14 Sep 2020 09:10:28 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
List-Subscribe:List-Post:List-Owner:List-Archive;
bh=fh53RGsXbcrY5WvGh76YOC617gv+W/TAHGFmA1Yk9qE=; b=Zz2FUkPHJZxkpC4dJcyBBoCeTD
GGTf/yIeUkq3QecYvlzDDqEgn3gXapOPmfCUw4a25dE3OOZLfzrYa8czdcPKMF9oOVpVxAxVWjdXb
/UrtnPToYmXsTLEo02TrJChpIAOJC2hqU/+pQIs/zUUBRP23FPxKjIl/v5znhAWTTS8k=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
by quimby with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.92) (envelope-from <larsi@HIDDEN>)
id 1kHoFP-0001pA-AD; Mon, 14 Sep 2020 15:10:21 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause
References: <871vbedfzq.fsf@HIDDEN> <87d1abu09j.fsf@HIDDEN>
<87injkq5la.fsf@HIDDEN> <87a84wu5tr.fsf@lylat>
X-Now-Playing: Xiu Xiu's _Girl with Basket of Fruit_: "Ice Cream Truck"
Date: Mon, 14 Sep 2020 15:10:17 +0200
In-Reply-To: <87a84wu5tr.fsf@lylat> (Alex's message of "Sat, 24 Jun 2017
21:03:28 -0600")
Message-ID: <87v9gga4hy.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
has NOT identified this incoming email as spam. The original
message has been attached to this so you can view it or label
similar future email. If you have any questions, see
@@CONTACT_ADDRESS@@ for details.
Content preview: Alex <agrambot@HIDDEN> writes: > You're right, sorry. This
breaks loops with variables that are updated > in loop-for-steps rather than
loop-for-sets. When I started testing > other cases I was accidentally using
the pre-patch bran [...]
Content analysis details: (-2.9 points, 5.0 required)
pts rule name description
---- ---------------------- --------------------------------------------------
-1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP
-1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1%
[score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 6583
Cc: 6583 <at> debbugs.gnu.org, npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Alex <agrambot@HIDDEN> writes:
> You're right, sorry. This breaks loops with variables that are updated
> in loop-for-steps rather than loop-for-sets. When I started testing
> other cases I was accidentally using the pre-patch branch to do so.
>
> I can't think of an easy solution to cover both problems right now. If
> no one better suited can figure this out, I'll come back to this after
> completing an ert suite for cl-loop (of which I'm part-way through).
Alex, this was three years ago. Did you make any progress here? :-)
(loop for elem in '(1 2 3)
for k = elem and j = 99
do
(print k))
still displays 1 1 2, which has to be wrong...
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.npostavs@HIDDEN
to control <at> debbugs.gnu.org.
Full text available.Received: (at 6583) by debbugs.gnu.org; 25 Jun 2017 03:03:47 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 24 23:03:47 2017 Received: from localhost ([127.0.0.1]:36133 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1dOxpy-00046R-S3 for submit <at> debbugs.gnu.org; Sat, 24 Jun 2017 23:03:47 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:36534) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <agrambot@HIDDEN>) id 1dOxpw-00046C-JA for 6583 <at> debbugs.gnu.org; Sat, 24 Jun 2017 23:03:44 -0400 Received: by mail-io0-f196.google.com with SMTP id h134so10424525iof.3 for <6583 <at> debbugs.gnu.org>; Sat, 24 Jun 2017 20:03:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=1fRC7Np1/ai2A2EtuE4C0y9k384Utq1pITDrvpODnug=; b=mOiXvCKq7bwLBhe9FwYgZBbOMrLEOHYYdcm5XqT6Wleqy8ztVNNAcmD27JvEODF7Vr QaDtN4srQEu3W/zGjt7VXREfwaVK17GDSLqYck63X+iqlh4d3/RnEZ7cAu3oxGLEEjHY hE+PWHxS6pOuPHOaoh3F5h3M8Qp1sWaB2fv3494C0cM6S0Dhs0sGRDibb7ZS7Vjg9Cfp xA2mk0PKSvT860bjSAyc+xM7eMTm4YaVMmurSDDy0/fGezZ6s/PsOUX22roZZPBqRMJ6 fVgBVYpaMr3LDUAd6+3RHxQsCSMCx2tSJhYoQc2SOsDPopZhZWAsqom8USnSROtdZVxA npdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version; bh=1fRC7Np1/ai2A2EtuE4C0y9k384Utq1pITDrvpODnug=; b=cpcrGuXegSqy2YbYb1ez22hr5YZw/J8EjHqlTWs0t1EgpWgbUGebcCmN1SiXJgWO6C MlZ4/cpkqySH2F3EYPIMCQEGqQZahuAfQNjJ+rsQSScOOBMtqyqM7AYsvxrNfr5tRQhY SheMzFiv/IqJF/h4Ne8n/pyPDsm4RCvy4PWYjgzYN9ppMZprnNQnJ+5BJ4JpmzZeIHMv FVTA80cBxnALSV+uJ3XMPuhv0QWw0P0tI2Z+dRZeBldzl9w5Oklt5L1Yr51YWWj/1mPX +amTdFJbdAy6EaWNb2Sw0RyDnPnofkf0GpIqywh3spDPn81hUrZhbNGZI6aUtWxc+r/n lLtQ== X-Gm-Message-State: AKS2vOxZQOhprHW2yGbAjCnp36Xu/WFN2TdXMtamBIZWssGDxEYhllQ3 97fMOox9wsHsfPtu X-Received: by 10.107.8.14 with SMTP id 14mr15146352ioi.197.1498359818687; Sat, 24 Jun 2017 20:03:38 -0700 (PDT) Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59]) by smtp.gmail.com with ESMTPSA id r124sm5412893iod.38.2017.06.24.20.03.37 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 24 Jun 2017 20:03:37 -0700 (PDT) From: Alex <agrambot@HIDDEN> To: npostavs@HIDDEN Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause References: <871vbedfzq.fsf@HIDDEN> <87d1abu09j.fsf@HIDDEN> <87injkq5la.fsf@HIDDEN> Date: Sat, 24 Jun 2017 21:03:28 -0600 In-Reply-To: <87injkq5la.fsf@HIDDEN> (npostavs's message of "Sat, 24 Jun 2017 20:22:09 -0400") Message-ID: <87a84wu5tr.fsf@lylat> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 6583 Cc: 6583 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -2.3 (--) npostavs@HIDDEN writes: > Alex <agrambot@HIDDEN> writes: > I can't claim to fully understand the loop macro implementation, but > your patch breaks this example from the manual `(cl) For Clauses': > > (cl-loop for x below 5 for y = nil then x collect (list x y)) > => ((0 nil) (1 1) (2 2) (3 3) (4 4)) > (cl-loop for x below 5 and y = nil then x collect (list x y)) > => ((0 nil) (1 0) (2 1) (3 2) (4 3)) > > With your patch the second loop gives ((0 nil) (1 1) (2 2) (3 3) (4 4)) > like the first. You're right, sorry. This breaks loops with variables that are updated in loop-for-steps rather than loop-for-sets. When I started testing other cases I was accidentally using the pre-patch branch to do so. I can't think of an easy solution to cover both problems right now. If no one better suited can figure this out, I'll come back to this after completing an ert suite for cl-loop (of which I'm part-way through).
bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.
Received: (at 6583) by debbugs.gnu.org; 25 Jun 2017 00:20:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 24 20:20:40 2017
Received: from localhost ([127.0.0.1]:36099 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1dOvI8-0000S4-Fh
for submit <at> debbugs.gnu.org; Sat, 24 Jun 2017 20:20:40 -0400
Received: from mail-io0-f195.google.com ([209.85.223.195]:35164)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <npostavs@HIDDEN>) id 1dOvI6-0000Rr-GL
for 6583 <at> debbugs.gnu.org; Sat, 24 Jun 2017 20:20:39 -0400
Received: by mail-io0-f195.google.com with SMTP id 84so4472694iop.2
for <6583 <at> debbugs.gnu.org>; Sat, 24 Jun 2017 17:20:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
:user-agent:mime-version;
bh=vPeHTfKL4qv58K4jCAeq1m8/npZyV9X3u5AjIRpEvHs=;
b=oZwW+mrv53hDF6MzUBGSSfomEauXft0l5TueSlMc0puixDd+I0ODCRuf5hHwZ2luPM
99UkbD8tSjh7ZGSWWMS66Hhjp4zforxq/fAibbnedFyoU2nayKc4SvWixccVFvFgB0Jf
mtFmx6cYP0/rwN2yeo7S8coCcnME2YcZLaQ0VtYvgt65ssHjED3PjTaXP7alGiyKPdzz
lD5Dmr+pbhbBLHj5s4RU+XG0BZ+prSMtmqGIYA7awTIdQvWjMzl6FEkQspmA4CMYFhwZ
Ox0Hbuf4zO9+x629/3BY+FnwRr69DzGKgCMU2FjbE3XCce9BtkClM5IQUNvDxpc7tyj+
1DBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:sender:from:to:cc:subject:references:date
:in-reply-to:message-id:user-agent:mime-version;
bh=vPeHTfKL4qv58K4jCAeq1m8/npZyV9X3u5AjIRpEvHs=;
b=gcb4xkZqVfQPzk+v6d1YfZ1jsnPY3B9ec6GgxoolPbpa+uScRf5rTDVV6j1C46jjIw
IE3xCYF5G8uN55EmupeqlgfbDMLArGL9ydVNtoJonGdg39j9U+vLKJOITexQNG3la3x1
GehbSBwp7BpWJojFA1DEkLnPV3EiymNW0rs6G+TpSg7tdEnyAbwnVboyxob3y/zaXDTq
hejKNhm7lI/RyZjKbE9gFlgbvVzxPxL2PYE1mvDliiYm0aGda7Kfw52l0aEpGOAynWSF
zx+DvqHNYYiL4dKMB1ERCtmZH8eR5mfa6qV749P62EL71vZO+1K6Pe9y+/MEjNUwAp4W
NDbA==
X-Gm-Message-State: AKS2vOwVrYmne4pRlQEuSLgn7nogGZNk/6yOwAYQ5i2YV8WoYq7vdsBQ
KiM10hSwI3C9loTO
X-Received: by 10.107.62.132 with SMTP id l126mr4550723ioa.162.1498350032660;
Sat, 24 Jun 2017 17:20:32 -0700 (PDT)
Received: from zony ([45.2.7.65])
by smtp.googlemail.com with ESMTPSA id j21sm5375709itb.15.2017.06.24.17.20.31
(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
Sat, 24 Jun 2017 17:20:31 -0700 (PDT)
From: npostavs@HIDDEN
To: Alex <agrambot@HIDDEN>
Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause
References: <871vbedfzq.fsf@HIDDEN> <87d1abu09j.fsf@HIDDEN>
Date: Sat, 24 Jun 2017 20:22:09 -0400
In-Reply-To: <87d1abu09j.fsf@HIDDEN> (Alex's message of "Sat, 10 Jun 2017
13:10:32 -0600")
Message-ID: <87injkq5la.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.1 (--)
X-Debbugs-Envelope-To: 6583
Cc: 6583 <at> debbugs.gnu.org, Kevin Ryde <user42@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)
Alex <agrambot@HIDDEN> writes:
>
> This problem appears to have been present even in the initial revision
> (fcd737693e8), specifically in the (eq word '=) clause.
>
> I see no reason for the (or ands (eq (car args) 'and)) consequent, as
> what it does when it detects an 'and is:
>
> * In the first iteration, set var (k) to the first form (elem) at the
> beginning of the iteration
>
> * In subsequent iterations, set var (k) to itself at the beginning of
> the iteration (noop)
>
> * At the end of every iteration, set var (k) to the second form
> (defaulting to the first form, elem).
>
> The last point is the main problem: you can't set the variable to the
> first form at the end of the iteration as it might depend on other loop
> variables (in this case elem) that are updated at the beginning of the
> iteration.
>
> I've attached a patch below that appears to solve this issue. With the
> patch, var is set to the first or second form at the beginning of the
> iteration (just like it is when no 'and is present).
I can't claim to fully understand the loop macro implementation, but
your patch breaks this example from the manual `(cl) For Clauses':
(cl-loop for x below 5 for y = nil then x collect (list x y))
=> ((0 nil) (1 1) (2 2) (3 3) (4 4))
(cl-loop for x below 5 and y = nil then x collect (list x y))
=> ((0 nil) (1 0) (2 1) (3 2) (4 3))
With your patch the second loop gives ((0 nil) (1 1) (2 2) (3 3) (4 4))
like the first.
bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.Alex <agrambot@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 6583) by debbugs.gnu.org; 10 Jun 2017 19:10:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 10 15:10:58 2017
Received: from localhost ([127.0.0.1]:39363 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1dJlmk-0000Qx-IN
for submit <at> debbugs.gnu.org; Sat, 10 Jun 2017 15:10:58 -0400
Received: from mail-io0-f193.google.com ([209.85.223.193]:36387)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <agrambot@HIDDEN>)
id 1dJlmh-0000QT-Sp; Sat, 10 Jun 2017 15:10:57 -0400
Received: by mail-io0-f193.google.com with SMTP id i93so7589985iod.3;
Sat, 10 Jun 2017 12:10:55 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
h=from:to:cc:subject:references:date:in-reply-to:message-id
:user-agent:mime-version;
bh=aGYHJ05nPb3Yfc+i+QfM6O6PdLLLuJ4dHIxAl5vr3LY=;
b=t+sBRa9xKkRjArsSj5838M3KLZ2Xyl0RhqlL5teKS7RBJCnt3GV1M/nTNWyErPYLKE
4oRZ93PK3+LDZcV69BZIr2IVNvBNEPq5gDXyLI49pyC8ecqECr31a+wZHNAT7M5R7bfI
suYl0c8067V9uoQJhsoo1oZhuYOiI4GOcmFwC2nwbTr06JsJM/KPc1gGfAP51XtEXN+R
cuqQHu8Q5JjD4sh5ZKbTge7/7DcZfZvGvNulYzVBfaD0aHwD20CjxaAJBGSfQih9Qssh
Mq6j9Z9EZchOmaosxqg0U9BkSBKwZSHJ51z7x9k/jneB18TmvT0cDCkCAd+LCHFLYr36
HN/Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20161025;
h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
:message-id:user-agent:mime-version;
bh=aGYHJ05nPb3Yfc+i+QfM6O6PdLLLuJ4dHIxAl5vr3LY=;
b=n47BVpgygtthMF+9XZkKFAiR/L1MpKaZaow8+3jr8WyoWX+neGV6wc4YzLwV3VP99P
o4OFXkDdwm3bnusBzrSpBMbFRUcsTMVuHMbA46PSy1isTd69/AdSUXUsX4WSiooFn/dn
gEo+CJCJN41j9cuRQaprX3qCrBgNiYEyhjX3KErzOrLtYOH3uyQ+z3yHJQYDF4GE7f9H
gACU1xb0SKempbp3XchvvzNcSj7exxcxx5ljZd+MQhcrGq22F/9/f0M7yY2zeND0uCJw
G8KjjtjM3XQNLaVypLCp5GfDyHL+WxNC8ejDqYohvCA2OtNaecNY2erlyIzvGI6vmKUR
k1fA==
X-Gm-Message-State: AODbwcDTNIRHlDZGtp4ECeLKcEYbTHbSJGbRk0ybpy6EyW4BEOQJlA/Q
C4ZbYHNB+8oEUzxq
X-Received: by 10.107.53.152 with SMTP id k24mr19585774ioo.7.1497121849883;
Sat, 10 Jun 2017 12:10:49 -0700 (PDT)
Received: from lylat (S010664777d9cebe3.ss.shawcable.net. [70.64.85.59])
by smtp.gmail.com with ESMTPSA id e8sm2245255iod.56.2017.06.10.12.10.33
(version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
Sat, 10 Jun 2017 12:10:48 -0700 (PDT)
From: Alex <agrambot@HIDDEN>
To: Kevin Ryde <user42@HIDDEN>
Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause
References: <871vbedfzq.fsf@HIDDEN>
Date: Sat, 10 Jun 2017 13:10:32 -0600
In-Reply-To: <871vbedfzq.fsf@HIDDEN> (Kevin Ryde's message of "Thu, 08 Jul
2010 09:33:29 +1000")
Message-ID: <87d1abu09j.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -1.0 (-)
X-Debbugs-Envelope-To: 6583
Cc: 6583 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
--=-=-=
Content-Type: text/plain
tags 6583 patch
quit
Kevin Ryde <user42@HIDDEN> writes:
> Evaluating
>
> (require 'cl)
> (loop for elem in '(1 2 3)
> for k = elem and j = 99
> do
> (print k))
>
> shows
>
> 1
> 1
> 2
>
> 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.
This problem appears to have been present even in the initial revision
(fcd737693e8), specifically in the (eq word '=) clause.
I see no reason for the (or ands (eq (car args) 'and)) consequent, as
what it does when it detects an 'and is:
* In the first iteration, set var (k) to the first form (elem) at the
beginning of the iteration
* In subsequent iterations, set var (k) to itself at the beginning of
the iteration (noop)
* At the end of every iteration, set var (k) to the second form
(defaulting to the first form, elem).
The last point is the main problem: you can't set the variable to the
first form at the end of the iteration as it might depend on other loop
variables (in this case elem) that are updated at the beginning of the
iteration.
I've attached a patch below that appears to solve this issue. With the
patch, var is set to the first or second form at the beginning of the
iteration (just like it is when no 'and is present).
--=-=-=
Content-Type: text/x-diff
Content-Disposition: attachment;
filename=0001-Fix-and-in-cl-loop-s-for-as-equals-then-subclause.patch
Content-Description: loop
From 48c59a8609e325690d9568d991bea7fd199a1acd Mon Sep 17 00:00:00 2001
From: Alexander Gramiak <agrambot@HIDDEN>
Date: Sat, 10 Jun 2017 12:26:48 -0600
Subject: [PATCH] Fix 'and in cl-loop's for-as-equals-then subclause
Update variables in the subclause correctly, and only once (Bug#6583).
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause): Remove faulty
conditional branch.
---
lisp/emacs-lisp/cl-macs.el | 23 +++++++----------------
1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index db1518ce61..8222f0dc34 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1273,22 +1273,13 @@ cl--parse-loop-clause
(then (if (eq (car cl--loop-args) 'then)
(cl--pop2 cl--loop-args) start)))
(push (list var nil) loop-for-bindings)
- (if (or ands (eq (car cl--loop-args) 'and))
- (progn
- (push `(,var
- (if ,(or cl--loop-first-flag
- (setq cl--loop-first-flag
- (make-symbol "--cl-var--")))
- ,start ,var))
- loop-for-sets)
- (push (list var then) loop-for-steps))
- (push (list var
- (if (eq start then) start
- `(if ,(or cl--loop-first-flag
- (setq cl--loop-first-flag
- (make-symbol "--cl-var--")))
- ,start ,then)))
- loop-for-sets))))
+ (push (list var
+ (if (eq start then) start
+ `(if ,(or cl--loop-first-flag
+ (setq cl--loop-first-flag
+ (make-symbol "--cl-var--")))
+ ,start ,then)))
+ loop-for-sets)))
((memq word '(across across-ref))
(let ((temp-vec (make-symbol "--cl-vec--"))
--
2.11.0
--=-=-=--
bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.Noam Postavsky <npostavs@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Noam Postavsky <npostavs@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.Noam Postavsky <npostavs@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 6583) by debbugs.gnu.org; 2 Jun 2016 22:07:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 02 18:07:13 2016
Received: from localhost ([127.0.0.1]:52148 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1b8all-0002E1-65
for submit <at> debbugs.gnu.org; Thu, 02 Jun 2016 18:07:13 -0400
Received: from mail-oi0-f51.google.com ([209.85.218.51]:34274)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <npostavs@HIDDEN>) id 1b8alb-0002DB-KJ
for 6583 <at> debbugs.gnu.org; Thu, 02 Jun 2016 18:07:12 -0400
Received: by mail-oi0-f51.google.com with SMTP id e72so99742279oib.1
for <6583 <at> debbugs.gnu.org>; Thu, 02 Jun 2016 15:07:03 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
h=mime-version:sender:date:message-id:subject:from:to
:content-transfer-encoding;
bh=Ib7L3SLSxIiirDoiS4tz00Xl5NdC9BBjqIxxjh+4xo0=;
b=teKLUj3K2fuFCu4TGu+Y2/1620OXJhCWnwHuEpsERRhOSPsW3acgod5lV7lBybV1T1
Ocv50C6a2IaINSMoSimixzm4SlK6O72IZxh4pUVKrlGTHfmXQ3+1+/DtRrbq5Gs0aMpS
V+SqG591j0LbGqrhRjMDQ8U6LbwK4dxjv0TXSU5i3qD6KU6w0Y6exDkUZzRw087pnIrm
PeuA+QPkx+0NrM8AdnyWYqnf1Uphc5vboLhzrdGS3SUNkqd9Ltfl7rnHITFGRCFxB8PR
5AsDhbsGRzZWg1x1EAUEtVFsYqkkZ9OsXBWBZ92i4fKCP6XG3VZJhRwIhlE/EALgwlwm
dpsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:mime-version:sender:date:message-id:subject:from
:to:content-transfer-encoding;
bh=Ib7L3SLSxIiirDoiS4tz00Xl5NdC9BBjqIxxjh+4xo0=;
b=BTxjJtqmf/WqYMx25yEuF9n4Y3ONxbhllO9j27mOqPX1jJDdCIfOt/08F7czR9tcK6
/tk7YXpovfWClOV9Ykw4jNtTTqN0bcxJJTgxcuMGxbk31MJmj8g6BWHzzQD6ranqJZa0
LM8P4zF4aHcPuk6rH2yjPdN2ZVVUlV3xI3SWVfd5HLVPi7oweetRaGYaHVFDn22LtT/C
ronmvVkHguJU9nuLMzQqPCUJSdBDf6rrAo7n7qI+PyWoV1IbWwmPyRolAVADhsGqwWSU
Yiw5mHwxLUHy1FQniDUaHTM+zhixsRnpLjkGg449IRuDMuhlpP205dz3ozHXlwfFhR4U
Wldw==
X-Gm-Message-State: ALyK8tLzUyf3PYvdgK5L9Tl7nofGcnvsnNb6AUlwz3c+Y6UnaC9jDB/0HA6Tz+isP9bi8Mo6DZ4aD+dQZHL/wg==
MIME-Version: 1.0
X-Received: by 10.157.29.10 with SMTP id m10mr251029otm.196.1464905218111;
Thu, 02 Jun 2016 15:06:58 -0700 (PDT)
Received: by 10.157.34.169 with HTTP; Thu, 2 Jun 2016 15:06:58 -0700 (PDT)
Date: Thu, 2 Jun 2016 18:06:58 -0400
X-Google-Sender-Auth: dP5-2NRsenda8YnNQdcIoIX2iu0
Message-ID: <CAM-tV-9yYKLU5FAh6v=EXWRxonTvCjTqd71TSn36af36KXo-qg@HIDDEN>
Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause
From: Noam Postavsky <npostavs@HIDDEN>
To: 6583 <at> debbugs.gnu.org
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: 6583
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.5 (/)
tag 6583 + confirmed
found 6583 24.5
found 6583 25.0.94
quit
Thierry Volpiatto <thierry.volpiatto <at> gmail.com> wrote:
> IMHO this is not correct, 'and' clauses should be used after conditionals
> (e.g if, when etc..)
No, it should also work for 'for' clauses, as documented in CL Hyperspec [1=
]
for-as-clause::=3D {for | as} for-as-subclause {and for-as-subclause}*
and Emacs' CL manual [2]
If you include several =E2=80=98for=E2=80=99 clauses in a row, they are=
treated
sequentially (as if by =E2=80=98let*=E2=80=99 and =E2=80=98setq=E2=80=
=99). You can instead use the
word =E2=80=98and=E2=80=99 to link the clauses, in which case they are =
processed in
parallel (as if by =E2=80=98let=E2=80=99 and =E2=80=98cl-psetq=E2=80=99=
).
The SBCL example is just missing the 'do', that's why it failed.
[1]: http://www.lispworks.com/documentation/lw51/CLHS/Body/m_loop.htm
[2]: http://www.gnu.org/software/emacs/manual/html_node/cl/For-Clauses.html
bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 8 Jul 2010 08:32:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 08 04:32:17 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1OWmWn-0005MB-1N
for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 04:32:17 -0400
Received: from mail.gnu.org ([199.232.76.166] helo=mx10.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWmWk-0005M6-R7
for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 04:32:15 -0400
Received: from lists.gnu.org ([199.232.76.165]:49566)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWmWh-00085l-VN
for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 04:32:12 -0400
Received: from [140.186.70.92] (port=45643 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1OWmWg-0002E7-Oj
for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 04:32:11 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
T_RP_MATCHES_RCVD,
T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWmWf-0007bW-7E
for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 04:32:10 -0400
Received: from lo.gmane.org ([80.91.229.12]:45418)
by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWmWe-0007bL-UL
for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 04:32:09 -0400
Received: from list by lo.gmane.org with local (Exim 4.69)
(envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWmWZ-0004Yj-NE
for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 10:32:03 +0200
Received: from garnet.epcc.ed.ac.uk ([129.215.56.222])
by main.gmane.org with esmtp (Gmexim 0.1 (Debian))
id 1AlnuQ-0007hv-00
for <bug-gnu-emacs@HIDDEN>; Thu, 08 Jul 2010 10:32:03 +0200
Received: from wence by garnet.epcc.ed.ac.uk with local (Gmexim 0.1 (Debian))
id 1AlnuQ-0007hv-00
for <bug-gnu-emacs@HIDDEN>; Thu, 08 Jul 2010 10:32:03 +0200
X-Injected-Via-Gmane: http://gmane.org/
To: bug-gnu-emacs@HIDDEN
From: Lawrence Mitchell <wence@HIDDEN>
Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause
Date: Thu, 08 Jul 2010 09:28:35 +0100
Lines: 21
Message-ID: <pvhp630qqswc.fsf@HIDDEN>
References: <871vbedfzq.fsf@HIDDEN>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: usenet@HIDDEN
X-Gmane-NNTP-Posting-Host: garnet.epcc.ed.ac.uk
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (usg-unix-v)
Cancel-Lock: sha1:K4X6v13FTlWrYMPiRFyVqCkw7Ew=
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-Spam-Score: -5.3 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.3 (-----)
Kevin Ryde wrote:
[...]
> 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
> ...
Note the idiomatic way of writing this loop:
(loop for (k . v) in my-alist
do ...)
Although this does not address the question of the bug.
--
Lawrence Mitchell <wence@HIDDEN>
owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.Received: (at submit) by debbugs.gnu.org; 8 Jul 2010 07:43:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jul 08 03:43:37 2010 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1OWllg-00052H-FW for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 03:43:37 -0400 Received: from mx10.gnu.org ([199.232.76.166]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWlle-00052A-H6 for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 03:43:35 -0400 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 <geb-bug-gnu-emacs@HIDDEN>) id 1OWllb-000758-Lh for submit <at> debbugs.gnu.org; Thu, 08 Jul 2010 03:43:31 -0400 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@HIDDEN; Thu, 08 Jul 2010 03:43:31 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, T_RP_MATCHES_RCVD, T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWllW-0007hm-Sc for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 03:43:28 -0400 Received: from lo.gmane.org ([80.91.229.12]:60202) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWllW-0007hB-GY for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 03:43:26 -0400 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from <geb-bug-gnu-emacs@HIDDEN>) id 1OWllR-00071F-RI for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 09:43:21 +0200 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 <bug-gnu-emacs@HIDDEN>; Thu, 08 Jul 2010 09:43:21 +0200 Received: from thierry.volpiatto by 22.77.197-77.rev.gaoland.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for <bug-gnu-emacs@HIDDEN>; Thu, 08 Jul 2010 09:43:21 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: bug-gnu-emacs@HIDDEN From: Thierry Volpiatto <thierry.volpiatto@HIDDEN> Subject: Re: bug#6583: 23.2; cl loop macro with `and' clause Date: Thu, 08 Jul 2010 09:40:22 +0200 Organization: ThierryVolpiatto Lines: 101 Message-ID: <87hbkah15l.fsf@HIDDEN> References: <871vbedfzq.fsf@HIDDEN> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@HIDDEN 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-Spam-Score: -5.2 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Sender: debbugs-submit-bounces <at> debbugs.gnu.org Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org X-Spam-Score: -5.2 (-----) Kevin Ryde <user42@HIDDEN> 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/
owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 7 Jul 2010 23:34:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jul 07 19:34:02 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1OWe7u-0001fU-0c
for submit <at> debbugs.gnu.org; Wed, 07 Jul 2010 19:34:02 -0400
Received: from mx10.gnu.org ([199.232.76.166])
by debbugs.gnu.org with esmtp (Exim 4.69)
(envelope-from <gg@HIDDEN>) id 1OWe7s-0001fM-3i
for submit <at> debbugs.gnu.org; Wed, 07 Jul 2010 19:34:01 -0400
Received: from lists.gnu.org ([199.232.76.165]:56468)
by monty-python.gnu.org with esmtps
(TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60)
(envelope-from <gg@HIDDEN>) id 1OWe7m-0001LW-Ri
for submit <at> debbugs.gnu.org; Wed, 07 Jul 2010 19:33:54 -0400
Received: from [140.186.70.92] (port=59422 helo=eggs.gnu.org)
by lists.gnu.org with esmtp (Exim 4.43) id 1OWe7k-0005zY-UC
for bug-gnu-emacs@HIDDEN; Wed, 07 Jul 2010 19:33:53 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE
autolearn=unavailable version=3.3.1
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69)
(envelope-from <gg@HIDDEN>) id 1OWe7j-0005tv-5c
for bug-gnu-emacs@HIDDEN; Wed, 07 Jul 2010 19:33:52 -0400
Received: from mailout2-6.pacific.net.au ([61.8.2.229]:35937
helo=mailout2.pacific.net.au) by eggs.gnu.org with esmtp (Exim 4.69)
(envelope-from <gg@HIDDEN>) id 1OWe7i-0005tN-Ja
for bug-gnu-emacs@HIDDEN; Wed, 07 Jul 2010 19:33:51 -0400
Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au
[61.8.2.162])
by mailout2.pacific.net.au (Postfix) with ESMTP id 816A5223246
for <bug-gnu-emacs@HIDDEN>; Thu, 8 Jul 2010 09:33:46 +1000 (EST)
Received: from blah.blah (ppp2EFE.dyn.pacific.net.au [61.8.46.254])
by mailproxy1.pacific.net.au (Postfix) with ESMTP id A60838C0A
for <bug-gnu-emacs@HIDDEN>; Thu, 8 Jul 2010 09:33:45 +1000 (EST)
Received: from gg by blah.blah with local (Exim 4.72)
(envelope-from <gg@HIDDEN>) id 1OWe7N-0007AE-Dh
for bug-gnu-emacs@HIDDEN; Thu, 08 Jul 2010 09:33:29 +1000
From: Kevin Ryde <user42@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 23.2; cl loop macro with `and' clause
Date: Thu, 08 Jul 2010 09:33:29 +1000
Message-ID: <871vbedfzq.fsf@HIDDEN>
User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.2 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
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-Spam-Score: -5.6 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/pipermail/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -5.6 (-----)
Evaluating
(require 'cl)
(loop for elem in '(1 2 3)
for k = elem and j = 99
do
(print k))
shows
1
1
2
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
Kevin Ryde <user42@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.owner <at> debbugs.gnu.org, bug-gnu-emacs@HIDDEN:bug#6583; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.