From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: pcase docstring tweaks Date: Tue, 27 Oct 2015 15:54:23 +0100 Message-ID: <87bnbkicps.fsf@web.de> References: <83r3kmrtat.fsf@gnu.org> <87r3kl22zk.fsf@web.de> <837fmdzpf2.fsf@gnu.org> <87oafp659p.fsf@web.de> <831tclzly9.fsf@gnu.org> <87fv115t20.fsf@web.de> <20151024090146.GA1849@acm.fritz.box> <878u6spgmp.fsf@gmx.net> <20151024174719.GB2731@acm.fritz.box> <87ziz8nkue.fsf@gmx.net> <20151024192858.GC2731@acm.fritz.box> <87h9lf95qn.fsf_-_@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1445957712 14290 80.91.229.3 (27 Oct 2015 14:55:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 27 Oct 2015 14:55:12 +0000 (UTC) Cc: Eli Zaretskii , Stephen Berman , Oleh Krehel , Stefan Monnier , Emacs Development To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 27 15:55:05 2015 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 1Zr5eP-0007YK-G8 for ged-emacs-devel@m.gmane.org; Tue, 27 Oct 2015 15:55:01 +0100 Original-Received: from localhost ([::1]:60236 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr5eP-0001ci-0R for ged-emacs-devel@m.gmane.org; Tue, 27 Oct 2015 10:55:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39075) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr5e2-0001Yy-Vl for emacs-devel@gnu.org; Tue, 27 Oct 2015 10:54:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zr5e1-0006V9-If for emacs-devel@gnu.org; Tue, 27 Oct 2015 10:54:38 -0400 Original-Received: from mout.web.de ([212.227.17.11]:52618) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zr5dx-0006Sj-7X; Tue, 27 Oct 2015 10:54:33 -0400 Original-Received: from drachen.dragon ([90.186.3.87]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0LaTid-1aDHEg2dLD-00mI4B; Tue, 27 Oct 2015 15:54:29 +0100 In-Reply-To: <87h9lf95qn.fsf_-_@web.de> (Michael Heerdegen's message of "Sun, 25 Oct 2015 02:00:48 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:QIgF6rL7l5lcNViGHe+4MAK8tVIzAtGRCgUCdaVWSxoq2FbqeE4 RUFS6cjsEJZoTgRy4IdjzN5mFsKPiPHswnmh0feO/RL7Gal8kpaH2c4Jj4gZ4XH9K4Ezh8t 3T0OaXA5UTRQ4/pa9B5y7Oc5KcDbLzYp1ORrGzkkVWkdeWiC7Ccxb+ixMP1TBXI9/w5RpoR oVTXK99RONg89Y2dsSzPg== X-UI-Out-Filterresults: notjunk:1;V01:K0:dhfa1KXtKD0=:FcU6lUXOI+yJvZxHmM42yZ 5Z8EeOcfHZZ1WIz8Fz7fWJtBZV62eenTkn0sJAUV1K/12k3Ff0mfB8ZEwUNYxvuHRXqWuf6kw gRsKkgP5BvtRwV+sXHEe10d4dvcAYoPK2Q/DBMjU8NdJ498YZGh892/OlOFBxKRZaQcdfwYng Hlchz6LmNLeNyOcYsPCdSUStw7cmqODA4DOx/gSBhq1g9Dx09QBOmn4+cYrG9c95cQzIn+gEB Eq6rkUKCPjYZne/AHBg5dUCX1d+eno2eFpGo+uAILowsQWb0vB/EJVV4O4a+5UQnJ8Yu/+mQ4 AsHgDyqJ7zCIi7wwYCmtNqV80bp4NEHT2KYOH/5P7LQVAI9SMIG/WORGS/Tvo4PQ7sZ29IEME +BltNB5+OKxcDYpjeNfNUGdURJ+X57AubCMUO9oW0Wx4RAIJi3HLYIQaogP3pqGz9m+9lJuPF 9XZCVQXcJqOPtKHorPzOzQe13Xv3wH7xi6o6NOK5RbO+kRUe7fGtNUFyRvWlEycMAbSm6fexd B4widrYKYDDctEyt0S3o9OwOQYmFRxJ/wyqeM8tdRNeut5qT4x2UjwsazUXkIRN/HlG5l60y3 +738tdf4GTCVIXlQzmiwzqjuthB4G+sbyA6Q9pud3PuwgDuM/6dTYbcqqlxBxiBu5YPLC4bqe fwHEiYJMToE/R06EzIwHxxQvZT3i6IGunusHicwUVrBuwdyVHz1irsBgg31YF7VyA7DUMDx8c LougudRE8SjBdHP++X0p8WExSeh4e5EY3mlw77wSi9RLfvByK7fBClDYbpyLnYoK7x6LrLh7 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.17.11 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:192731 Archived-At: Hello, Stefan, ok to install this? And as I said before: anyone is invited to bike shedding ;-) > Let's continue with the `pcase' docstring. I think it's already quite > good. Here is a patch emphasizing that EXP is actually evaluated (I > think that is not evident) and some more or less cosmetic changes. Is > it clear then? > > > *** /tmp/ediff17164yyt 2015-10-25 01:54:53.175155728 +0200 > --- /home/micha/software/emacs/lisp/emacs-lisp/pcase.el 2015-10-25 00:35:23.999856799 +0200 > *************** > *** 107,113 **** > > ;;;###autoload > (defmacro pcase (exp &rest cases) > ! "Perform ML-style pattern matching on EXP. > CASES is a list of elements of the form (PATTERN CODE...). > > Patterns can take the following forms: > --- 107,113 ---- > > ;;;###autoload > (defmacro pcase (exp &rest cases) > ! "Eval EXP and perform ML-style pattern matching on that value. > CASES is a list of elements of the form (PATTERN CODE...). > > Patterns can take the following forms: > *************** > *** 115,123 **** > SYMBOL matches anything and binds it to SYMBOL. > (or PAT...) matches if any of the patterns matches. > (and PAT...) matches if all the patterns match. > ! \\='VAL matches if the object is `equal' to VAL > ATOM is a shorthand for \\='ATOM. > ! ATOM can be a keyword, an integer, or a string. > (pred FUN) matches if FUN applied to the object returns non-nil. > (guard BOOLEXP) matches if BOOLEXP evaluates to non-nil. > (let PAT EXP) matches if EXP matches PAT. > --- 115,123 ---- > SYMBOL matches anything and binds it to SYMBOL. > (or PAT...) matches if any of the patterns matches. > (and PAT...) matches if all the patterns match. > ! \\='VAL matches if the object is `equal' to VAL. > ATOM is a shorthand for \\='ATOM. > ! when ATOM is a keyword, an integer, or a string. > (pred FUN) matches if FUN applied to the object returns non-nil. > (guard BOOLEXP) matches if BOOLEXP evaluates to non-nil. > (let PAT EXP) matches if EXP matches PAT. > *************** > *** 131,141 **** > which is the value being matched. > So a FUN of the form SYMBOL is equivalent to one of the form (FUN). > FUN can refer to variables bound earlier in the pattern. > - FUN is assumed to be pure, i.e. it can be dropped if its result is not used, > - and two identical calls can be merged into one. > E.g. you can match pairs where the cdr is larger than the car with a pattern > like \\=`(,a . ,(pred (< a))) or, with more checks: > \\=`(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a)))) > > Additional patterns can be defined via `pcase-defmacro'. > Currently, the following patterns are provided this way:" > --- 131,141 ---- > which is the value being matched. > So a FUN of the form SYMBOL is equivalent to one of the form (FUN). > FUN can refer to variables bound earlier in the pattern. > E.g. you can match pairs where the cdr is larger than the car with a pattern > like \\=`(,a . ,(pred (< a))) or, with more checks: > \\=`(,(and a (pred numberp)) . ,(and (pred numberp) (pred (< a)))) > + FUN is assumed to be pure, i.e. it can be dropped if its result is not used, > + and two identical calls can be merged into one. > > Additional patterns can be defined via `pcase-defmacro'. > Currently, the following patterns are provided this way:" Thanks, Michael.