[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Code for cond*
From: |
Alfred M. Szmidt |
Subject: |
Re: Code for cond* |
Date: |
Thu, 25 Jan 2024 10:44:52 -0500 |
> On Jan 25, 2024, at 10:17â¯AM, JD Smith <jdtsmith@gmail.com> wrote:
>
>
>
>> On Jan 25, 2024, at 8:57â¯AM, Stefan Monnier <monnier@iro.umontreal.ca>
wrote:
>>
>>>>
>>>> (cond-let
>>>> (((var value)
>>>> (dvar (derived-from var))
>>>> ((has-the-right-stuff-p dvar)))
>>>> (cons 'correct dvar))
>>>>
>>>> (((foo value2)
>>>> (bar (1- foo))
>>>> ((< bar 0)))
>>>> (cons 'incorrect bar))
>>>>
>>>> (t nil))
>>
>
>> Personally, I was thinking of a syntax like
>>
>> (my-cond
>> (:let var value)
>> (:let dvar (derived-from var))
>> ((has-the-right-stuff-p dvar)
>> (cons 'correct dvar))
>>
>> (:let foo value2)
>> (:let bar (1- foo))
>> ((< bar 0)
>> (cons 'incorrect bar))
>>
>> (t nil))
And it perhaps goes without saying that the two approaches could be combined
:) â
(cond-let
(:let var-for-rest value)
Is there a reason why using a keyword here? How would multiple
bindings be handled -- or is that what the two forms:
(:let foo value2)
(:let bar (1- foo))
try to convey?
This feels like stabbing your eyeballs with a rusty nail and pouring
salt ... The first suggestion was much nicer, and clearer.
(simple0-using-var-for-rest body0) ; a normal cond-like clause
(bindings1 body1-including-var-for-rest)
(:let another-var (some-function var-for-rest))
(bindings2-using-another-var body2)
(bindings3 body3-using-another-var)
(t fallthrough-body))
- Re: Code for cond*, (continued)
- RE: [External] : Re: Code for cond*, Drew Adams, 2024/01/24
- RE: [External] : Re: Code for cond*, Drew Adams, 2024/01/24
- Re: Code for cond*, Madhu, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*,
Alfred M. Szmidt <=
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, Alfred M. Szmidt, 2024/01/25
- Re: Code for cond*, Stefan Monnier, 2024/01/25
- Re: Code for cond*, JD Smith, 2024/01/25
- Re: Code for cond*, Richard Stallman, 2024/01/28
Re: Code for cond*, Richard Stallman, 2024/01/25