[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lexical let and setq
From: |
Stefan Monnier |
Subject: |
Re: Lexical let and setq |
Date: |
Sun, 15 Sep 2013 01:11:38 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
> I think the most common reason for stashing a lot of variables in a let
> is to avoid infinite indentation.
> (let ((a (foo)))
> (something)
> (let ((b (something-else)))
> (more a b)
> (let ((c (yet-more)))
> (zot a b c))))
> vs
> (let ((a (foo))
> b c)
> (something)
> (setq b (something-else))
> (more a b)
> (setq c (yet-more))
> (zot a b c))
> I kinda think the latter form is sometimes more readable.
In SML (where `setq' is not an option), the natural way to write it is
equivalent to:
(let* ((a (foo))
(_ (something))
(b (something-else))
(_ (more a b))
(c (yet-more)))
(zot a b c))
-- Stefan