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: The poor state of documentation of pcase like things. Date: Sat, 19 Dec 2015 18:40:25 +0100 Message-ID: <87r3iiuyk6.fsf@web.de> References: <20151216202605.GA3752@acm.fritz.box> <83d1u4xhja.fsf@gnu.org> <8737uytov3.fsf@web.de> <83bn9mv01p.fsf@gnu.org> 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 1450546852 9100 80.91.229.3 (19 Dec 2015 17:40:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 19 Dec 2015 17:40:52 +0000 (UTC) Cc: kaushal.modi@gmail.com, jwiegley@gmail.com, emacs-devel@gnu.org, acm@muc.de To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Dec 19 18:40:44 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 1aALUp-0003Dl-25 for ged-emacs-devel@m.gmane.org; Sat, 19 Dec 2015 18:40:43 +0100 Original-Received: from localhost ([::1]:38128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALUo-00029M-3E for ged-emacs-devel@m.gmane.org; Sat, 19 Dec 2015 12:40:42 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55255) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALUj-00029A-Gp for emacs-devel@gnu.org; Sat, 19 Dec 2015 12:40:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aALUi-00058O-6p for emacs-devel@gnu.org; Sat, 19 Dec 2015 12:40:37 -0500 Original-Received: from mout.web.de ([212.227.17.11]:57728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aALUe-00057t-2L; Sat, 19 Dec 2015 12:40:32 -0500 Original-Received: from drachen.dragon ([90.186.0.6]) by smtp.web.de (mrweb101) with ESMTPSA (Nemesis) id 0MbhFJ-1ZrRCI3vpV-00J69q; Sat, 19 Dec 2015 18:40:28 +0100 In-Reply-To: <83bn9mv01p.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 19 Dec 2015 19:08:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-Provags-ID: V03:K0:l6ZHDVr2r7z5OUqfcNGWSpyor6U2z1oLRJTKjEqxVExYF9TmVu4 D85j0wnilufhaC0p9LLPXk1/eCwPcN+6dbcpUVY/sHtB5EGKywmTDdEb40RzcL+v8lLQm0S 3Jx4wieryXuG6HZHTCdQ3R4a37GFUfFg8LNDjWjED/fioRVWLzK+vnxvtfxhxFiktMlh5D3 li6wJt/Y3ZVSGVbWn6+bw== X-UI-Out-Filterresults: notjunk:1;V01:K0:GZxUrwnoI6U=:brLtOe2ivQbZn2hJhB59nH MbK6I4bxOnawTLQX98jJtMpUuAf6Dtn7B8q4yP+w+rXs+Nyh/GE3CKZb3c9HFeB6AzN1wInBI pIVlug8Duw5wEzYj/nzRxYjSB5HQlkazNCRZKo2LndWb6/MCmr3mkgnsRbXOUz8tNUdnyvqqe RFSEByMVZcwuLaGEwlYoPggsZmOZgc0Gill4vIOqJk/9ShrEapK9oo3VKWqDt+v/IRGMub09C l8QB/kz0sK8Kk4bFVzCXf1vfEPhIa0pAg1jriKmD9ZQmJMr7nI6AvSuP9OYtcILEeSnBux7FT V3s1qxL7OqzpKdCnvym/GkPBZHr4apJlA6TrVK9kCNvkYWivN9PlSWrVjjGWsJTdCiT5iluJM ufxei6426KPa8HnQUUGGmk6sZjzY8OLO6IYqKAIk5HoCVk2HHT1Y1wiTzJMyeRe2+y/ACphOZ 7OGmgKS4QKg6xTcTe6T2ujX8iT+ZGhTwE5vVnAdEHM2iVmCTxoYZdRb3fLiML99o3fpnjfDaL ij9N2Zk+JsDcDBblUXok12h7uUJnAVWnG72AZjaDnZDGkOv5S1gIOpH155bcNCughc+Tkj7bR N91LJ1GuMkQdFNs1KimonFgSMJbSfCD2Z9WGcaf1tCZLdAhkAwWyV4aOyxV9AqYCh05Gp+1SW EuZG15uraT80BaLAo5VCfnO6vckwFI5nfdk0y3y6bWZBvRI7DxATB4TZz7DFgjkYQ9BRFuOIB Ppogck6igXRxTn9/38jLdHbrGzi4+HkpvA0NTF//MMNdfyF5EtdmbtDVtMDhU40EMYVwAYfb 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:196517 Archived-At: Eli Zaretskii writes: > > > Why did you use 'lambda' for the 3rd predicate, but not for the 2nd? > > > Is it just a way to show off use of 'lambda', or is there some > > > significant difference between these 2 use cases that requires a > > > 'lambda' in the latter case? More generally, when is 'lambda' > > > required in a predicate like these ones? > >=20 > > That's explained in the pcase docstring. > > Which part of it? (pred FUN) matches if FUN applied to the object returns non-nil. [...] FUN can take the form SYMBOL or (lambda ARGS BODY) in which case it=E2=80=99s called with one = argument. (F ARG1 .. ARGn) in which case F gets called with an n+1=E2=80=99th argum= ent which is the value being matched. So, FUN is generally a symbol or a lambda, as everywhere, nothing special. In addition there is a=20 (F ARG1 .. ARGn) ("in which case F gets called with an n+1=E2=80=99th argument which is the = value being matched.") form that can be used to abbreviate things in some cases. Probably you got confused with this additional possible syntax. > > > Isn't it true that pcase-let is just a short-hand for a pcase that > > > assigns values according to patterns, and has nil as the default > > > value? If that's true, I think it explains better what pcase-let > > > does, especially when backed up by an example of a pcase and the > > > equivalent pcase-let. > >=20 > > I think there are more differences, AFAICT pcase-let can't "fail" > > Neither can a pcase that has a default clause, right? Yes - but `pcase-let' never fails AFAIR, no matter how the clauses look like. > Did John's tutorial include an example of that? Haven't looked yet. > Or maybe I shouldn't ask about pcase-let, as it's not for the > uninitiated yet? ;-) I don't expect the semantics of `pcase-let' to change much in the future, and I think it's quite unquestioned that it's useful and a good-to-have form per se. Michael.