From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: phillip.lord@russet.org.uk (Phillip Lord) Newsgroups: gmane.emacs.devel Subject: Re: The poor state of documentation of pcase like things. Date: Thu, 17 Dec 2015 21:16:56 +0000 Message-ID: <87fuz0ydvb.fsf@russet.org.uk> References: <20151216202605.GA3752@acm.fritz.box> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1450387038 15836 80.91.229.3 (17 Dec 2015 21:17:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 17 Dec 2015 21:17:18 +0000 (UTC) Cc: Alan Mackenzie , Emacs developers To: Kaushal Modi Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Dec 17 22:17:08 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 1a9fv8-0000ri-IL for ged-emacs-devel@m.gmane.org; Thu, 17 Dec 2015 22:17:06 +0100 Original-Received: from localhost ([::1]:57234 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9fv7-0006Ms-Tb for ged-emacs-devel@m.gmane.org; Thu, 17 Dec 2015 16:17:05 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54522) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9fv5-0006Ln-54 for emacs-devel@gnu.org; Thu, 17 Dec 2015 16:17:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a9fv1-0001ji-W1 for emacs-devel@gnu.org; Thu, 17 Dec 2015 16:17:03 -0500 Original-Received: from cheviot22.ncl.ac.uk ([128.240.234.22]:54828) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a9fv1-0001ja-PZ for emacs-devel@gnu.org; Thu, 17 Dec 2015 16:16:59 -0500 Original-Received: from smtpauth-vm.ncl.ac.uk ([10.8.233.129] helo=smtpauth.ncl.ac.uk) by cheviot22.ncl.ac.uk with esmtp (Exim 4.63) (envelope-from ) id 1a9fuz-0004O0-G1; Thu, 17 Dec 2015 21:16:58 +0000 Original-Received: from cpc6-benw10-2-0-cust45.gate.cable.virginm.net ([92.238.179.46] helo=localhost) by smtpauth.ncl.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.63) (envelope-from ) id 1a9fuz-0008Q7-LD; Thu, 17 Dec 2015 21:16:57 +0000 In-Reply-To: (John Wiegley's message of "Thu, 17 Dec 2015 08:34:27 -0800") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 128.240.234.22 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:196430 Archived-At: John Wiegley writes: >>>>>> Kaushal Modi writes: > >> I would welcome a short tutorial on how (and why) to use pcase. > > There are several examples shown here: > > http://www.emacswiki.org/emacs/PatternMatching > > pcase makes a lot more sense if you're used to pattern matching in functional > languages, where you describe a pattern (not unlike destructuring-bind) whose > "shape" is intended to match the set of shapes you want to successful match > against. > > Since pattern matching like this isn't something I had ever encountered > outside of FP, I agree that a tutorial is in order. I'm willing to volunteer > for this. I'll have a go at the docstrings. I only found out about pcase recently. It's a very useful tool, and it deserves more use. Could I suggest it be promoted in the manual a little. Currently, it's a subnode of "conditionals", but pattern match is really a form of control flow in its own right. Phil