unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: michael-franzese@gmx.com
To: "Óscar Fuentes" <ofv@wanadoo.es>
Cc: help-gnu-emacs@gnu.org
Subject: Re: pcase without code duplication
Date: Fri, 23 Apr 2021 05:45:43 +0200	[thread overview]
Message-ID: <trinity-b582db73-b8a1-456d-b2a5-d3c696103424-1619149543566@3c-app-mailcom-bs03> (raw)
In-Reply-To: <877dktel9m.fsf@telefonica.net>


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"))))
> 
> 
>



  reply	other threads:[~2021-04-23  3:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23  2:45 pcase without code duplication michael-franzese
2021-04-23  3:24 ` Óscar Fuentes
2021-04-23  3:45   ` michael-franzese [this message]
2021-04-23  4:01     ` Stefan Monnier
2021-04-23  3:51   ` [External] : " Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=trinity-b582db73-b8a1-456d-b2a5-d3c696103424-1619149543566@3c-app-mailcom-bs03 \
    --to=michael-franzese@gmx.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=ofv@wanadoo.es \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).