unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* (loop with (VAR1 VAR2) ...)
@ 2014-03-16 17:11 Thien-Thi Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2014-03-16 17:11 UTC (permalink / raw)
  To: help-gnu-emacs

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

Is the construct in the subject valid as an alternate form of:

 (loop with VAR1
       with VAR2
       ...)

?  It seems to work fine, but (info "(cl) Other Clauses")
doesn't mention it, so i wonder if i am planting a latent bug.

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (loop with (VAR1 VAR2) ...)
       [not found] <mailman.17317.1394989649.10748.help-gnu-emacs@gnu.org>
@ 2014-03-17  1:28 ` Barry Margolin
  2014-03-17  6:29   ` Thien-Thi Nguyen
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Margolin @ 2014-03-17  1:28 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.17317.1394989649.10748.help-gnu-emacs@gnu.org>,
 Thien-Thi Nguyen <ttn@gnu.org> wrote:

> Is the construct in the subject valid as an alternate form of:
> 
>  (loop with VAR1
>        with VAR2
>        ...)
> 
> ?  It seems to work fine, but (info "(cl) Other Clauses")
> doesn't mention it, so i wonder if i am planting a latent bug.

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.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: (loop with (VAR1 VAR2) ...)
  2014-03-17  1:28 ` (loop with (VAR1 VAR2) ...) Barry Margolin
@ 2014-03-17  6:29   ` Thien-Thi Nguyen
  0 siblings, 0 replies; 3+ messages in thread
From: Thien-Thi Nguyen @ 2014-03-17  6:29 UTC (permalink / raw)
  To: Barry Margolin; +Cc: help-gnu-emacs

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-17  6:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [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
2014-03-16 17:11 Thien-Thi Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).