From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Re: Replace trivial pcase occurrences in the Emacs sources Date: Wed, 31 Oct 2018 21:41:01 +0100 Message-ID: <87lg6dx31e.fsf@web.de> References: <83tvlcsnee.fsf@gnu.org> <20181029134722.GC4195@ACM> <87lg6gifnb.fsf@web.de> <87muqwxs7m.fsf@ericabrahamsen.net> <83h8h3jlyd.fsf@gnu.org> <8b897e43-679b-d38c-e185-0efe19c09342@yandex.ru> <83y3aei08p.fsf@gnu.org> <83o9bahz6i.fsf@gnu.org> <877ehyx7xg.fsf@web.de> <83d0rpj4y0.fsf@gnu.org> <871s85yjx9.fsf@web.de> <83a7mtj309.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1541018356 15190 195.159.176.226 (31 Oct 2018 20:39:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 31 Oct 2018 20:39:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: emacs-devel@gnu.org, monnier@IRO.UMontreal.CA, dgutov@yandex.ru To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 31 21:39:11 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gHxGh-0003r4-5c for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2018 21:39:11 +0100 Original-Received: from localhost ([::1]:33440 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHxIn-0001EN-GQ for ged-emacs-devel@m.gmane.org; Wed, 31 Oct 2018 16:41:21 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40001) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHxIh-0001E4-1d for emacs-devel@gnu.org; Wed, 31 Oct 2018 16:41:15 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHxIb-0006YP-7k for emacs-devel@gnu.org; Wed, 31 Oct 2018 16:41:14 -0400 Original-Received: from mout.web.de ([212.227.15.14]:45065) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHxIa-0006XY-UA; Wed, 31 Oct 2018 16:41:09 -0400 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MOB3E-1gEduE2jQa-005Yv6; Wed, 31 Oct 2018 21:41:02 +0100 Original-Received: from drachen.dragon ([94.218.210.177]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MOB3E-1gEduE2jQa-005Yv6; Wed, 31 Oct 2018 21:41:02 +0100 In-Reply-To: <83a7mtj309.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 31 Oct 2018 22:05:26 +0200") X-Provags-ID: V03:K1:Jd8+hRtZSe7LMX9CLDYzeGXK0PdfGiebXx9ivYTYOh6S9Tib/ne D9GpZGYf1Z+OZ5O5Pbkm/mGoGYTz25DXekCc9EAtimNx8V1zh3hP1XQLX5bjcfL3/TIL/DK uk38B0bADcIDD/ACk27DBqvdEfKRKkZvjSUCGryHg7jd5KXGYur1i6eSFBS5k/qTBVubDrl KhtCwawkI528DjOHumfqQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:zNvAEK65hu0=:GHqohd7K5JfaTunOZvF3Z9 enm/TbqDRydb/BLwZSD1i90VrOegN4c1K08gWXcLAlh2caKfqlebGO/fbZoYusKwVAa9fAyfL FEFXbvUvhIYHj8E+5z7llQ32751C7BQnLFBUDYKseH79tO4VsjzixFWA4ODq4IKae5bAKrtSE dqivINzxPKq1aYy35yLr2kac7G5bJH/wW8iDU5QDocsgsj1+oiFlEJBkbiaJOHLq1QzxC4tK0 aMP6tQ5YwR5APfoV4haIPnIGNxgfGBz0zkitcjByDs7ZIF+E6Ms1V2F8Qq1N3lE/uZ/jbjjs2 C+ndrdbvY4Q/YbJs+g+z0BdR0Bb+0qGs+XqPDsHvEEMFsNV3ImJWO2ZeThLYPFETpk6xZg0XW cGHCAxVlFDn6k7e3JGuhFruYQBwTQH7HgHd5z77wQDbrWCigrX1FrJYdLGwgyn2spNPYRRw6T PwudO5kxI1V4DSiBGk5zonYb+2G8hghjTTcnaax3gHHwH+4d+H16rSQWDLW8wU5DSdqL5uNO5 9SJiTyO+ye4phLuTwxQpMlYOy6h30IXy1lzVseSkKcjeY7kmlzgwTfzPWzPuOSe2lbzcTb2EU WzJQBBAuFty1q9c4gNhfIyi/X7uJK0Jq/ZKaOgDmhr+tVCoLn5zqovX5tZNcBh3SWQg4hCfBo aH9ipxBdugkgaeU+B72pY4XueNzGBfseS+GYmZ7BnChvP8qw3BbPDBuYmOAt0EBozmkaKsbZb 9TihZVT+agvCnkScSjxzFp3J7pIiu+U0MPP8vpXSHS8HDHbr7ptmF5Fc4Z6mLRblRYYESpwz X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.14 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:230918 Archived-At: Eli Zaretskii writes: > > (pcase '(1 2 3) > > ((let a 3) a)) > > ==> 3 > > Thanks, but I meant an example of what's described after the "OTOH". Oh, sorry. How about this: (defun second-elt-is-positive-p (l) (pcase l (`(,_ ,(pred (< 0)) . ,_) t))) (second-elt-is-positive-p (list 1 2 3)) ==> t (second-elt-is-positive-p (list 1 -2 3)) ==> nil Is the pattern `(,_ ,(pred (< 0)) . ,_) destructuring or does it additionally have to bind at least one variable to be called like that? Such patterns are used in real life - some bind variables, but others are only used as tests to see if the structure fulfils certain requirements. I guess there is no sharp dividing line. Michael.