unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Alan Mackenzie <acm@muc.de>
Cc: Eli Zaretskii <eliz@gnu.org>,
	Stephen Berman <stephen.berman@gmx.net>,
	Oleh Krehel <ohwoeowho@gmail.com>,
	Emacs Development <emacs-devel@gnu.org>
Subject: pcase docstring tweaks (was: Question on pcase)
Date: Sun, 25 Oct 2015 02:00:48 +0200	[thread overview]
Message-ID: <87h9lf95qn.fsf_-_@web.de> (raw)
In-Reply-To: <20151024192858.GC2731@acm.fritz.box> (Alan Mackenzie's message of "Sat, 24 Oct 2015 19:28:58 +0000")

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

Alan Mackenzie <acm@muc.de> writes:

> But I honestly think it's time for our discussion to cease.  We've
> unwittingly descended into bikeshedding, and we're not going to be
> helping Michael Heerdegen much with it.  But thanks for the discussion
> anyway!

I can only thank everyone who joined the discussion as well!  I'll think
carefully about all comments, and make the corrections.

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?



[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: pcase.patch --]
[-- Type: text/x-diff, Size: 2989 bytes --]

*** /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:"

[-- Attachment #3: Type: text/plain, Size: 26 bytes --]



Regards,

Michael.






  reply	other threads:[~2015-10-25  0:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-22 14:46 Question on pcase Oleh Krehel
2015-10-22 21:19 ` Michael Heerdegen
2015-10-23  6:30   ` Eli Zaretskii
2015-10-23 11:58     ` Oleh Krehel
2015-10-23 12:23       ` Michael Heerdegen
2015-10-23 12:42         ` Oleh Krehel
2015-10-23 13:07           ` Michael Heerdegen
2015-10-23 13:26             ` Oleh Krehel
2015-10-23 13:59               ` Michael Heerdegen
2015-10-27 23:50                 ` Johan Bockgård
2015-10-30  1:33                   ` Michael Heerdegen
2015-10-23 14:23               ` Michael Heerdegen
2015-10-23 12:17     ` Michael Heerdegen
2015-10-23 12:22       ` Oleh Krehel
2015-10-23 13:26       ` Eli Zaretskii
2015-10-23 14:14         ` Michael Heerdegen
2015-10-23 14:41           ` Eli Zaretskii
2015-10-23 18:38             ` Michael Heerdegen
2015-10-23 18:43               ` Eli Zaretskii
2015-10-23 19:59               ` Przemysław Wojnowski
2015-10-23 21:01                 ` Michael Heerdegen
2015-10-23 20:23               ` Przemysław Wojnowski
2015-10-23 20:39                 ` Michael Heerdegen
2015-10-24 11:37                   ` Przemysław Wojnowski
2015-10-24  9:01               ` Alan Mackenzie
2015-10-24 12:58                 ` Stephen Berman
2015-10-24 17:47                   ` Alan Mackenzie
2015-10-24 19:10                     ` Stephen Berman
2015-10-24 19:28                       ` Alan Mackenzie
2015-10-25  0:00                         ` Michael Heerdegen [this message]
2015-10-27 14:54                           ` pcase docstring tweaks Michael Heerdegen
2015-10-27 18:57                             ` Stefan Monnier
2015-10-27 20:14                               ` Michael Heerdegen
2015-10-28  3:15                             ` Richard Stallman
2015-10-28 17:08                               ` Michael Heerdegen
2015-10-24 17:00                 ` Question on pcase Drew Adams
2015-10-24 17:22                   ` Alan Mackenzie
2015-10-24 17:36                     ` Drew Adams
2015-10-24 20:03                     ` Johan Bockgård
2015-10-24 23:11                       ` Michael Heerdegen
2015-10-26 15:55               ` Oleh Krehel
2015-10-26 16:07                 ` Michael Heerdegen
2015-10-27  8:42                   ` Oleh Krehel
2015-10-26 16:20                 ` Michael Heerdegen
2015-10-27  8:42                   ` Oleh Krehel
2015-10-27 14:27                     ` Michael Heerdegen
2015-10-27 14:47                       ` Michael Heerdegen
2015-10-28 18:05                         ` Michael Heerdegen
2015-10-29  9:44                           ` Oleh Krehel
2015-10-30  1:11                             ` Michael Heerdegen
2015-10-26 16:35                 ` Andreas Schwab

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=87h9lf95qn.fsf_-_@web.de \
    --to=michael_heerdegen@web.de \
    --cc=acm@muc.de \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=ohwoeowho@gmail.com \
    --cc=stephen.berman@gmx.net \
    /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).