[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: pcase without code duplication
From: |
michael-franzese |
Subject: |
Re: pcase without code duplication |
Date: |
Fri, 23 Apr 2021 05:45:43 +0200 |
Can one also use nil as option in pcase. What possibilities
exist for (_ ?
e.g.
(nil
((or 0 nil)
((or _ nil)
Regards
Michael
> Sent: Friday, April 23, 2021 at 3:24 PM
> From: "Óscar Fuentes" <ofv@wanadoo.es>
> To: help-gnu-emacs@gnu.org
> Subject: Re: pcase without code duplication
>
> 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"))))
>
>
>