From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: pcase and minus-sign Date: Wed, 30 Nov 2016 16:34:08 +0100 Message-ID: <87d1hddlsf.fsf@web.de> References: <87r35tb0se.fsf@fastmail.fm> <87poldax6l.fsf@fastmail.fm> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1480520116 27052 195.159.176.226 (30 Nov 2016 15:35:16 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 30 Nov 2016 15:35:16 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux) Cc: Joost Kremers , Help Gnu Emacs mailing list To: Andreas =?utf-8?Q?R=C3=B6hler?= Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Nov 30 16:35:12 2016 Return-path: Envelope-to: geh-help-gnu-emacs@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 1cC6uc-0005mD-U3 for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2016 16:35:11 +0100 Original-Received: from localhost ([::1]:44677 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC6ud-0003EF-Kj for geh-help-gnu-emacs@m.gmane.org; Wed, 30 Nov 2016 10:35:11 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40074) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cC6tt-0003Cz-IJ for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 10:34:27 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cC6tq-0001Ox-FJ for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 10:34:25 -0500 Original-Received: from mout.web.de ([212.227.15.4]:64437) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cC6tq-0001MZ-59 for help-gnu-emacs@gnu.org; Wed, 30 Nov 2016 10:34:22 -0500 Original-Received: from drachen.dragon ([90.186.1.195]) by smtp.web.de (mrweb004 [213.165.67.108]) with ESMTPSA (Nemesis) id 0M9dCJ-1bziQN06L1-00CzJM; Wed, 30 Nov 2016 16:34:12 +0100 In-Reply-To: ("Andreas \=\?utf-8\?Q\?R\=C3\=B6hler\=22's\?\= message of "Wed, 30 Nov 2016 16:23:57 +0100") X-Provags-ID: V03:K0:lf4bcPKdRnqH5uFejSO1hyk9X3U0FGDKXhkGVJqii6p9r+MVuCj 8E9N9cFe+nIhzEINiaJSlRaTIyxmced0qXdTtIBbaOsOIeRrbpPtwHtydT1ZyLTxz0ipVXG UgFZGTfChNmGMBXB3th9ZhuD6T1UREdM2utKDw+3K6PNOyhITz+wKQYMMiytFUwyNXTkTGo B7OWh0TpxvhZyxEaiAD5Q== X-UI-Out-Filterresults: notjunk:1;V01:K0:1EkLSpz3Hh0=:UJ9lyjvPlMnMRAOXrOcB+Y 9cM6AafomTKTrLiRi72h/4DgZcMSVcscetd6n1W1d9oIVGlQYaJxrAY1AmEko0Zs2iWQ7IFP7 VFIwfN9izV27NOjrkeqZlJrlHMUJm/0QpPKSFQX1VxCaY/22zKndgXouMwK30fqmS7fuSXmpB bNF+LcnLBsFu99NU+OdTraIkhG6mlLlLZmb0Y5dYF2UIz3pl8J6ofcwE/oLyu9KJFcXbYUH/4 ec0lCbBvk8MyG50lPjMdEl3VkVJO/Qqxx5fa8whdbgWKB1hcnYXECyoRihoZtFh9RGq3Zrlav 6QQnLWOVBwvNvBp3snvBTezwS8yUY1bK4VaSv7z5boGgamYinyIULr+ec/WB/A/CS24btBBmq 96MI9X95tguFxLhsg38NKFfpzRhabvJMe4wJZ9eCK/saXoBi64G+c+BwdcHMorStNPxD4z8PG x3CGMG9MgqYlFfOzEnxkgbt8e6VKvC9ZZR50SXXh1OPjj3xuP+QYA5tzrBumxq7I1+dogAVpE cS+RIo7QHWHImwyO6rjquHp51d2+mggNSRrtOTzy8oEkMHMvB1bG47qyvV00Huj3ujIsJ04Sv aZ4/32CtqEdRrDIhgD68vvZqzxYA2+N4UawBpXHexYQuo/clQswGj+zfjJx67oE2kPkMAcBUL DfS+R7lAaFqefHucLjnwvyS0upTNAv5APd39P8x2OLJI/hkP1B9NceICUZ0W/2Z5N3Ek7o2vg 0yNrG4THC8oOgXjMV5opXQRt42rWg32Qqnq/La6KKy3BMs/GzKtjIWwszNdE+tzpe76NPr/Q X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 212.227.15.4 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111836 Archived-At: Andreas R=C3=B6hler writes: > But what make the char `a' so special WRT char `1'?: > > (defun foo (arg) > (interactive "P") > (pcase arg > (1 (message "%s" "ARG was `1'")) > (a (message "%s" "ARG was `a'")) > ('- (message "%s" "ARG was minus-sign")) > (_ (message "%s" "ARG not minus-sign")))) The Lisp reader maps "a" to a symbol, but "1" to an integer. As pcase patterns, symbols and integers have a different meaning. If pcase could only match against atoms, this would be strange. But pcase is not `case', and as already has been mentioned, being able to use variables in patterns (for binding or equivalence tests) is very useful. If you want to test whether your ARG is `equal' to some VALUE, you can always use 'VALUE as pattern. This is very consistent and easy to remember. Anything not quoted has a different meaning as a pattern. There is one exception: if VALUE is actually a keyword, an integer, or a string, you can omit the quote (as you do above for "1") - but you don't need to omit it. Symbols that are not keywords are not included in this list, because they already have a different meaning. Michael.