From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.devel Subject: RE: emacs-25 1d4887a: Improve documentation of 'pcase' Date: Mon, 25 Jan 2016 07:56:10 -0800 (PST) Message-ID: References: <20160123102327.23087.15367@vcs.savannah.gnu.org> <87vb6kzft1.fsf@web.de> <837fj05sum.fsf@gnu.org> <87h9i1rcpr.fsf@web.de> <87fuxlptj2.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1453737393 15027 80.91.229.3 (25 Jan 2016 15:56:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 25 Jan 2016 15:56:33 +0000 (UTC) To: Michael Heerdegen , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Jan 25 16:56:21 2016 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aNjV6-0006BG-TW for ged-emacs-devel@m.gmane.org; Mon, 25 Jan 2016 16:56:21 +0100 Original-Received: from localhost ([::1]:39401 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNjV6-0002o4-FU for ged-emacs-devel@m.gmane.org; Mon, 25 Jan 2016 10:56:20 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNjV2-0002no-JI for emacs-devel@gnu.org; Mon, 25 Jan 2016 10:56:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aNjUz-0000Ei-Bw for emacs-devel@gnu.org; Mon, 25 Jan 2016 10:56:16 -0500 Original-Received: from userp1040.oracle.com ([156.151.31.81]:48198) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aNjUz-0000EA-5B for emacs-devel@gnu.org; Mon, 25 Jan 2016 10:56:13 -0500 Original-Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id u0PFuC4u018461 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 25 Jan 2016 15:56:12 GMT Original-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.13.8) with ESMTP id u0PFuB7b016462 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Mon, 25 Jan 2016 15:56:11 GMT Original-Received: from abhmp0009.oracle.com (abhmp0009.oracle.com [141.146.116.15]) by aserv0122.oracle.com (8.13.8/8.13.8) with ESMTP id u0PFuBsj007226; Mon, 25 Jan 2016 15:56:11 GMT In-Reply-To: <87fuxlptj2.fsf@web.de> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.9 (901082) [OL 12.0.6691.5000 (x86)] X-Source-IP: userv0022.oracle.com [156.151.31.74] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 156.151.31.81 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:198779 Archived-At: > 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=C3=ABl" "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', `=3D', `string=3D', etc., and users can of course define their own.