[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Precedence of for clauses in cl-loop
From: |
Noam Postavsky |
Subject: |
Re: Precedence of for clauses in cl-loop |
Date: |
Fri, 7 Sep 2018 07:16:36 -0400 |
On 7 September 2018 at 03:08, Plamen Tanovski <pgt@tanovski.de> wrote:
> gives error, beacuse the z part is executed before the y line:
>
> (cl-loop
> for x in (number-sequence 1 10)
> for y = (1+ x)
> for z in (elt (number-sequence 1 10) y))
This example also gives an error:
(cl-loop
for x in (number-sequence 1 10)
for z in (elt (number-sequence 1 10) (1+ x)))
because a `for VAR in LIST' clause evaluates LIST just once before the
loop starts.
The "treated sequentially" in the manual refers to the assignment of
VAR. For example, this gives an error:
(cl-loop
for y = (1+ x)
for x in (number-sequence 1 10))
And this does not:
(cl-loop
for x in (number-sequence 1 10)
for y = (1+ x))