unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Michael Heerdegen <michael_heerdegen@web.de>, emacs-devel@gnu.org
Subject: RE: emacs-25 1d4887a: Improve documentation of 'pcase'
Date: Mon, 25 Jan 2016 07:56:10 -0800 (PST)	[thread overview]
Message-ID: <e0d04406-eae9-47cd-9912-2d65bb9b73d0@default> (raw)
In-Reply-To: <87fuxlptj2.fsf@web.de>

> FWIW Drew mentioned that it maybe could be cool if the equivalence
> predicate could be specified locally for a pcase form like
> (pcase my-string #'string-collate-equalp ("Noël" "Christmas")) or so.

I didn't remember suggesting that, but I guess maybe you meant this:

   I think [pcase] is only useful when destructuring is
   involved.  If it is just doing literal pattern-matching
   then it offers nothing more than does `cl-case'.

   (Unless it lets you change the equality predicate (does it?).
   That's one thing that I wish `cl-case' (and Common lisp `case')
   would let you do: specify ... a comparer other than `eql'.)

Anyway, it's a good idea, but unlike the simple case of Common Lisp
`case', `pcase' uses multiple complex patterns, and they can involve
destructuring.

So in principle there could be a need to specify different equality
predicates for different patterns of the same `pcase', or even for
different parts of the same pattern.

Or maybe the different-parts-of-the-same-pattern problem could
be expressed in stages, i.e., by breaking a complex pattern into
multiple simpler patterns, each possibly with its own equality
predicate.

When it comes to pattern matching, different equality predicates
can become important.  In Lisp, we have `eq', `equal', `eql', `=',
`string=', etc., and users can of course define their own.



  reply	other threads:[~2016-01-25 15:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20160123102327.23087.15367@vcs.savannah.gnu.org>
     [not found] ` <E1aMvLr-00060z-TI@vcs.savannah.gnu.org>
2016-01-23 11:38   ` emacs-25 1d4887a: Improve documentation of 'pcase' Michael Heerdegen
2016-01-23 13:27     ` Eli Zaretskii
2016-01-25 13:49       ` Michael Heerdegen
2016-01-25 14:36         ` Stefan Monnier
2016-01-25 15:29           ` Michael Heerdegen
2016-01-25 15:56             ` Drew Adams [this message]
2016-01-25 16:10               ` Michael Heerdegen
2016-01-25 16:48                 ` Drew Adams
2016-01-25 16:15             ` Stefan Monnier
2016-01-25 16:23         ` Eli Zaretskii
2016-01-25 16:43           ` Michael Heerdegen

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=e0d04406-eae9-47cd-9912-2d65bb9b73d0@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael_heerdegen@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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