all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Thien-Thi Nguyen <ttn@gnu.org>
To: Barry Margolin <barmar@alum.mit.edu>
Cc: help-gnu-emacs@gnu.org
Subject: Re: (loop with (VAR1 VAR2) ...)
Date: Mon, 17 Mar 2014 07:29:58 +0100	[thread overview]
Message-ID: <874n2xs5g9.fsf@zigzag.favinet> (raw)
In-Reply-To: <barmar-10637E.21280116032014@news.eternal-september.org> (Barry Margolin's message of "Sun, 16 Mar 2014 21:28:01 -0400")

[-- Attachment #1: Type: text/plain, Size: 960 bytes --]

() Barry Margolin <barmar@alum.mit.edu>
() Sun, 16 Mar 2014 21:28:01 -0400

   Does it mention "destructuring"? Any place where a single variable is 
   allowed, you can have a list of variables, and it will assign them from 
   the list of values.

It's mentioned specifically for ‘for’ VARs in (info "(cl) For Clauses")
so i suppose this is a doc bug (missing xref).  Or maybe the description
should be moved to "Loop Basics".  Anyway:

 (loop with (x y) = '(10 20) 
       for n upto 5 
       collect (cons (* n x) 
                     (* n y)))
 ((0 . 0)
  (10 . 20)
  (20 . 40)
  (30 . 60)
  (40 . 80)
  (50 . 100))

it works w/ ‘with’ as well as for ‘for’; i'm happy.  Thanks for the tip.

-- 
Thien-Thi Nguyen
   GPG key: 4C807502
   (if you're human and you know it)
      read my lisp: (responsep (questions 'technical)
                               (not (via 'mailing-list)))
                     => nil

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  reply	other threads:[~2014-03-17  6:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.17317.1394989649.10748.help-gnu-emacs@gnu.org>
2014-03-17  1:28 ` (loop with (VAR1 VAR2) ...) Barry Margolin
2014-03-17  6:29   ` Thien-Thi Nguyen [this message]
2014-03-16 17:11 Thien-Thi Nguyen

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=874n2xs5g9.fsf@zigzag.favinet \
    --to=ttn@gnu.org \
    --cc=barmar@alum.mit.edu \
    --cc=help-gnu-emacs@gnu.org \
    /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.