emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is this a bug in while-let or do I missunderstand it?


From: Andreas Schwab
Subject: Re: Is this a bug in while-let or do I missunderstand it?
Date: Sun, 10 Nov 2024 07:07:06 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

On Nov 09 2024, Joost Kremers wrote:

> Yes, but for `while`, the pattern isn't complete. The `setq` inside the
> loop is a crucial part:
>
> ```
> (let ((a (foo ...)))
>   (while a
>     (do-stuff-with a)
>     (setq a (foo ...))))
> ```

You can write it like this to avoid typing the condition twice:

 (let (a)
   (while (setq a (foo ...))
     (do-stuff-with a)))

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]