~technomancy/fennel

2 2

cond-like macro

Details
Message ID
<29928BC0-4C18-4DBF-9856-85D1106E8418@niemier.pl>
DKIM signature
missing
Download raw message
Sometimes I need to change some conditions and **I know** that only one will be true. It would be handy to have built-in macro that would allow something like

    (cond
      check1 action1
      check2 action2)

Right now the only way to achieve something similar from what I see is to do

    (match true
      (_ ? check1) action1
      (_ ? check2) action2)

Does anyone have macro that would achieve something like that? Maybe it would be useful to have such functionality built in.

--

Łukasz Niemier
lukasz@niemier.pl
Details
Message ID
<CAAKhXoYgVyL_bW0QPJiUJ0m+ufQkVsDjPFGnfySPbFA1EwqgSQ@mail.gmail.com>
In-Reply-To
<29928BC0-4C18-4DBF-9856-85D1106E8418@niemier.pl> (view parent)
DKIM signature
pass
Download raw message
unless I misunderstood you, `if` should be enough here, no?

(if check1 action1
    check2 action 2)

On Tue, Jan 26, 2021 at 7:07 PM Łukasz Niemier <lukasz@niemier.pl> wrote:
>
> Sometimes I need to change some conditions and **I know** that only one will be true. It would be handy to have built-in macro that would allow something like
>
>     (cond
>       check1 action1
>       check2 action2)
>
> Right now the only way to achieve something similar from what I see is to do
>
>     (match true
>       (_ ? check1) action1
>       (_ ? check2) action2)
>
> Does anyone have macro that would achieve something like that? Maybe it would be useful to have such functionality built in.
>
> --
>
> Łukasz Niemier
> lukasz@niemier.pl
>


-- 
Best regards,
Andrey Orst
Details
Message ID
<8A71088A-8FD1-4EA9-98F1-E49DD222B7F0@niemier.pl>
In-Reply-To
<CAAKhXoYgVyL_bW0QPJiUJ0m+ufQkVsDjPFGnfySPbFA1EwqgSQ@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
> unless I misunderstood you, `if` should be enough here, no?
> 
> (if check1 action1
>    check2 action 2)

I must have missed that syntax in the docs. Sorry for bother.

--

Łukasz Niemier
lukasz@niemier.pl
Reply to thread Export thread (mbox)