[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase without code duplication
From: |
Óscar Fuentes |
Subject: |
Re: pcase without code duplication |
Date: |
Fri, 23 Apr 2021 05:24:05 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
michael-franzese@gmx.com writes:
> I am using pcase, but am wondering whether I can have pcase
> for 0 and 2 do the same things without adding a separate pcase
> (0 and duplicating the statements.
>
> (pcase orthogr-region
> (0 ... ) ; same operations as pcase 2
> (1 ... )
> (2 ... ) ; operations
> (_ ... ) )
(let ((xx 2))
(pcase xx
(1 (message "one"))
((or 0 2) (message "zero or two"))
(_ (message "something else"))))