Subject: bug#29799: 24.5; cl-loop guard clause missing

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 22 Nov 2019 15:53:10 +0100

[email-masked] writes:

>>> ;; should return (1 0) (cl-loop with result for x below 3 for y below 2 and
>>> z = (progn (push x result) nil) finally return result)
>
>> I applied the patch and ran that test case, and it returned
>> (2 1 0).  But shouldn't it return (2 1)?
>
> Ah, clisp also returns (2 1 0), so while my initial claim is wrong, I am happy
> the patch conforms with clisp.
>
> My human instinct is to say it should return (1 0), but the simultaneity
> semantics of "and" are tricky.
>
> Under no interpretation, do I see it returning (2 1).
>
> iter#1 x is 0, *simultaneously* set y = 0 and result = (0)
> iter#2 x is 1, *simultaneously* set y = 1 and result = (1 0)
> iter#3 x is 2, *simultaneously* break out of loop and result = (2 1 0)

Yes, you're right -- I was somehow thinking that "below 3" meant the
same as "from 2 downto 0" instead of what it really means: "upto 2".
And that "for ... and" meant that I had never realised.  :-)

loop is a complicated language.

So it all looks correct to me now, and I'm applying your patch.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no