all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Noam Postavsky <npostavs@gmail.com>
To: Plamen Tanovski <pgt@tanovski.de>
Cc: Help Gnu Emacs mailing list <help-gnu-emacs@gnu.org>
Subject: Re: Precedence of for clauses in cl-loop
Date: Fri, 7 Sep 2018 07:16:36 -0400	[thread overview]
Message-ID: <CAM-tV--PEeDNsmHsRLOsVESxpXuFyhYoJutP=KfO901nxcowXw@mail.gmail.com> (raw)
In-Reply-To: <20180907070834.E7B4B3381CF@munka.dynalias.org>

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))



  reply	other threads:[~2018-09-07 11:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-06 18:33 Precedence of for clauses in cl-loop Plamen Tanovski
2018-09-06 22:43 ` Noam Postavsky
2018-09-07  7:08   ` Plamen Tanovski
2018-09-07 11:16     ` Noam Postavsky [this message]
2018-09-07 12:35       ` Plamen Tanovski
2018-09-08  1:37         ` Noam Postavsky
     [not found]         ` <mailman.511.1536370625.1284.help-gnu-emacs@gnu.org>
2018-09-08 14:41           ` Udyant Wig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAM-tV--PEeDNsmHsRLOsVESxpXuFyhYoJutP=KfO901nxcowXw@mail.gmail.com' \
    --to=npostavs@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pgt@tanovski.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.