[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Instead of pcase
From: |
Nikita Domnitskii |
Subject: |
Re: Instead of pcase |
Date: |
Tue, 28 Nov 2023 12:35:26 +0600 |
Richard Stallman <rms@gnu.org> writes:
> (cond* (:bind b1 (b (save-window-excursion (find-file-at-point filename))))
> ((bufferp b) (setq b1 b))
> ((bufferp (car-safe b)) (setq b1 (car-safe b))))
> (if b1 (switch-to-buffer-other-window b)))
>
> (cond* (:bind b1 (b (save-window-excursion (find-file-at-point filename))))
> ((bufferp b) (switch-to-buffer-other-window b))
> ((bufferp (car-safe b)) (switch-to-buffer-other-window (car-safe
> b)))))
>
> (let ((b (save-window-excursion (find-file-at-point filename))) b1)
> (if (or (match-set b1 b (bufferp b1))
> (match-set b1 (car-safe b) (bufferp b1)))
> (switch-to-buffer-other-window b1)))
To be honest all variants look less expressive than original
pcase.
Maybe instead of trying to implement cond* we should look into impoving
pcase patterns? As a starting point I suggest Racket pattern matching
implementation (which in my opinion is fairly readable):
https://docs.racket-lang.org/reference/match.html
--
Best Regards,
Nikita Domnitskii
- Re: Instead of pcase, (continued)
- Re: Instead of pcase, Richard Stallman, 2023/11/27
- Re: Instead of pcase, Dmitry Gutov, 2023/11/28
- Re: Instead of pcase, Richard Stallman, 2023/11/29
- Re: Instead of pcase, Michael Heerdegen, 2023/11/24
- Re: Instead of pcase, Dmitry Gutov, 2023/11/24
- Re: Instead of pcase, Richard Stallman, 2023/11/26
- Re: Instead of pcase, Richard Stallman, 2023/11/27
- Re: Instead of pcase,
Nikita Domnitskii <=
- Re: Instead of pcase, Richard Stallman, 2023/11/29
- Re: Instead of pcase, Dmitry Gutov, 2023/11/19
- Re: Instead of pcase, Richard Stallman, 2023/11/20
- Re: Instead of pcase, Jim Porter, 2023/11/21
- Re: Instead of pcase, Yuri Khan, 2023/11/21
- Re: Instead of pcase, Dmitry Gutov, 2023/11/21
- Re: Instead of pcase, Michael Heerdegen, 2023/11/21
- Re: Instead of pcase, Richard Stallman, 2023/11/22
- Re: Instead of pcase, Richard Stallman, 2023/11/23
- Re: Instead of pcase, Jim Porter, 2023/11/23