From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.devel Subject: Re: pcase ` meaning Date: Tue, 30 Oct 2018 23:05:08 +0700 Message-ID: References: <20151216202605.GA3752@acm.fritz.box> <87h9iunkcg.fsf@web.de> <87h8hc4xw2.fsf_-_@web.de> <83tvlcsnee.fsf@gnu.org> <87pnw037ar.fsf@web.de> <83ftwvs7y9.fsf@gnu.org> <877ei7mkfh.fsf@web.de> <87a7mze7tl.fsf@web.de> <87zhuykjjh.fsf@web.de> <871s8aesdc.fsf@portable.galex-713.eu> <87tvl6dc3e.fsf_-_@portable.galex-713.eu> <87efc9isxj.fsf@web.de> <87tvl5653j.fsf@portable.galex-713.eu> <87zhuxhbeo.fsf@web.de> <87lg6hxda6.fsf@portable.galex-713.eu> <87va5kigkp.fsf@web.de> <87va5kqrxz.fsf@portable.galex-713.eu> <87zhuwwbkc.fsf@web.de> <87in1kqocw.fsf@portable.galex-713.eu> 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 1540915503 16760 195.159.176.226 (30 Oct 2018 16:05:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 30 Oct 2018 16:05:03 +0000 (UTC) Cc: Michael Heerdegen , Eli Zaretskii , Emacs developers , Stefan Monnier , Dmitry Gutov To: galex-713@galex-713.eu Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Oct 30 17:04:58 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 1gHWVl-0004CM-Kp for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 17:04:57 +0100 Original-Received: from localhost ([::1]:54202 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHWXr-0007S2-Mu for ged-emacs-devel@m.gmane.org; Tue, 30 Oct 2018 12:07:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46393) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gHWWp-0006tP-Uw for emacs-devel@gnu.org; Tue, 30 Oct 2018 12:06:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gHWWm-0006v3-4t for emacs-devel@gnu.org; Tue, 30 Oct 2018 12:06:02 -0400 Original-Received: from mail-oi1-x232.google.com ([2607:f8b0:4864:20::232]:42924) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gHWWj-0004hu-6X; Tue, 30 Oct 2018 12:05:57 -0400 Original-Received: by mail-oi1-x232.google.com with SMTP id h23-v6so10874478oih.9; Tue, 30 Oct 2018 09:05:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=xmtoO7PQ+50wtIBb0ikni9bZ3ZYGpQBXkhRkw91+ou8=; b=cSYLgQzek67pI+IYrvy0u7u+ifvsjGfvVlCe/I0+f43Z8rH30mz5Ig2ExbQmP9IWQZ Ma34ZgZsPLZUunF9wdzT+zH6qtgAZNm7iLOub611P87KQBIIPXC1jOGuF0esKed8Swqn sxAZ4LL94y/cHoLi0raWGY9xU4VUhta8XXkYSGNmtCdfT7ht1hn/MQt+s0fcCTRAUCa6 CsYgjhui7Xu3QB3P8DCs2qkzqyouzCpAMIQzZSgJxnYSuSBs3kF+0Oqcqrstyrh0Bubo zvXNy97TJCeRBxn8leiLqfsIr+T22DDukytMuWf1AshshH7e/4ohr/IvjO25e8KY+W2x kIMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=xmtoO7PQ+50wtIBb0ikni9bZ3ZYGpQBXkhRkw91+ou8=; b=rM7WY2+vMG9QCobM0Rufg1foqJOHhsLXW+FGSJeZaaUVk8WqX8Ou1KB5gM7EH05mOR 7u2v6iS6/0PtrKK136LreYP7tMc57XzHXLtUrfBoaTXQXhU1LQuJGnqN3I3Si2nRKXqa 90kLbkcgEnkC8aQmxdlywBwglpZOMvJu0Yd9885NHsorircD5VwTJ1Voi/ZCZG/yHR1a ZQjKgQFKhSkO2wrQp4RGotkOgD7Ht8WjWa/DbuKtVAw3l/y0kDX6GM78/dV3qBYhj7Yj r7M37Dd375fY+5Av661D+W6+degbzEIafUZyEkvz34TxVGAL4hoRfg/VC2HUXr0rXBGq Gq8w== X-Gm-Message-State: AGRZ1gKQYCS+UU4TnQ0zjiy5uGri+nCTO1uhqJcy86ShHseqTT1LrM7c SwS29qLJpR985NtoEx5AfEqm/6fPxlWpzhgpFjA= X-Google-Smtp-Source: AJdET5e185ZjlyHimJWY6WyManG7qTxJ9o7W9pIb7jmSB68kPb5IwRJMLFHH3Is50WpiYqwI0sw28+JEbzTRdpCahVw= X-Received: by 2002:aca:4b55:: with SMTP id y82-v6mr11830465oia.88.1540915534143; Tue, 30 Oct 2018 09:05:34 -0700 (PDT) In-Reply-To: <87in1kqocw.fsf@portable.galex-713.eu> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::232 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:230831 Archived-At: On Tue, Oct 30, 2018 at 7:18 AM Garreau, Alexandre wrote: > (pcase `(1 2 3) (`(1 2 3) t)) > > look the same, as well as: > > (pcase `(a b c) (`(a b c) t)) > > But not: > > (pcase `(1 2 3) (`(,a ,b ,c) (+ a b c))) IMO you=E2=80=99re giving too much attention to =E2=80=9Clooking the same= =E2=80=9D. You use identifiers a, b, and c in a pattern. The pattern matcher needs to know which of these you meant as placeholders to bind, and which as literal symbols to match against. (let ((c 42)) (pcase `(a x 42) (`(a ,b ,(pred (equal c))) t))) In an alternate world, you would color the parentheses, the spaces, and the literal symbol =E2=80=9Ca=E2=80=9D yellow, and say these are the th= ings to match literally. You would then color =E2=80=9Cb=E2=80=9D and =E2=80=9Cc=E2= =80=9D white, and say these are placeholders. You might even color something green and say these are expressions whose values should be taken and matched. In that same world, you could draw nested boxes instead of these nested parentheses that make newbies so nervous about Lisp. However, in this world, we only encode Unicode characters in our source files, and add color only as an aid to understanding. So we use various funny characters such as parentheses to denote nesting, and ` and , to denote color. (Upthread, the idea of =E2=80=9Choles=E2=80=9D was mentioned. That is a ver= y good analogy, both for pcase and for quoting/antiquoting in general.)