[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: (loop with (VAR1 VAR2) ...)
From: |
Thien-Thi Nguyen |
Subject: |
Re: (loop with (VAR1 VAR2) ...) |
Date: |
Mon, 17 Mar 2014 07:29:58 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
() 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
pgpc9IUAopMLN.pgp
Description: PGP signature