[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: |
Sat, 09 Nov 2024 18:33:46 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
On Nov 09 2024, Eli Zaretskii wrote:
>> It can be convenient to bind variables in conjunction with using a
>> conditional. It's often the case that you compute a value, and then
>> want to do something with that value if it's non-‘nil’. The
>> straightforward way to do that is to just write, for instance:
>>
>> (let ((result1 (do-computation)))
>> (when result1
>> (let ((result2 (do-more result1)))
>> (when result2
>> (do-something result2)))))
>>
>> Since this is a very common pattern, Emacs provides a number of
>> macros to make this easier and more readable. The above can be written
>> the following way instead:
>>
>> ... following the various with various FOO-let forms, ending with
>> while-let.
>
> The above description actually supports what Yuri was saying, not what
> Arthur and you expect.
The description only talks about when, where the condition is only
evaluated once not matter what. If you replace when with while you have
a very different situation.
--
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."
- Sv: Is this a bug in while-let or do I missunderstand it?, (continued)
- Sv: Is this a bug in while-let or do I missunderstand it?, arthur miller, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Yuri Khan, 2024/11/09
- Sv: Is this a bug in while-let or do I missunderstand it?, arthur miller, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Yuri Khan, 2024/11/09
- Sv: Is this a bug in while-let or do I missunderstand it?, arthur miller, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Yuri Khan, 2024/11/09
- Sv: Is this a bug in while-let or do I missunderstand it?, arthur miller, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Alfred M. Szmidt, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Eli Zaretskii, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?, Eli Zaretskii, 2024/11/09
- Re: Is this a bug in while-let or do I missunderstand it?,
Andreas Schwab <=
- RE: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Drew Adams, 2024/11/09
- Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Alfred M. Szmidt, 2024/11/09
- Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Jens Schmidt, 2024/11/09
- Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Alfred M. Szmidt, 2024/11/09
- Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Joost Kremers, 2024/11/09
- Re: [External] : Re: Is this a bug in while-let or do I missunderstand it?, Alfred M. Szmidt, 2024/11/10
- Re: Better documentation for non-binding clauses of if-let and friends, Jens Schmidt, 2024/11/10
- Re: Better documentation for non-binding clauses of if-let and friends, Sean Whitton, 2024/11/10
- Re: Better documentation for non-binding clauses of if-let and friends, Jens Schmidt, 2024/11/10
- Re: Better documentation for non-binding clauses of if-let and friends, Alfred M. Szmidt, 2024/11/11