From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: "T.V Raman" Newsgroups: gmane.emacs.devel Subject: Re: Instead of pcase Date: Thu, 16 Nov 2023 10:51:45 -0800 Message-ID: <25942.25793.951307.572705@retriever.mtv.corp.google.com> References: <87fs169mjj.fsf@posteo.net> <093f11a1-57c2-5e56-d39b-26fef1c67cbb@gutov.dev> <25942.25061.217864.329049@retriever.mtv.corp.google.com> <87zfzdcz6z.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14164"; mail-complaints-to="usenet@ciao.gmane.io" Cc: raman@google.com, dmitry@gutov.dev, rms@gnu.org, emacs-devel@gnu.org To: philipk@posteo.net Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Nov 16 19:52:24 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r3hTT-0003ah-N2 for ged-emacs-devel@m.gmane-mx.org; Thu, 16 Nov 2023 19:52:23 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3hSy-0003ke-Su; Thu, 16 Nov 2023 13:51:52 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3hSx-0003iM-NU for emacs-devel@gnu.org; Thu, 16 Nov 2023 13:51:51 -0500 Original-Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3hSw-00015Z-8a for emacs-devel@gnu.org; Thu, 16 Nov 2023 13:51:51 -0500 Original-Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1cc3c51f830so9833765ad.1 for ; Thu, 16 Nov 2023 10:51:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1700160708; x=1700765508; darn=gnu.org; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:from:to:cc:subject:date :message-id:reply-to; bh=GK32dK+kRAbEvEN+cIi7x52r6Yj0fd73HOgDmkIVuhw=; b=alDCg87yC35jfZ8vSpqIU5RVFJIDTHJr4LtOzTegBGbsLT9x1JIRft8CMuATfpl5ai tnOAWVg/37XSvQ7r0I7mWPTH/IXHk1pR/Oa45PHWK3oJbjco0xJOZcUQQXQkRTirARkG d3rksIOV6UmmtLfKJAZXfG/bpQ8TSzslQjV5wAIS7p856T/FcGOClF6J17d6lrvupVoq lBs4Fak9LaPBK1ApWvnxUJYcPrX7UGhh2RbE6NY3VjgrSKSBSdWghGA0VafvQB1uNRwE OGIM1RCEP0yntBNYkDrvpjqiKt1bTNY08+m3E1nhN5cVorKIgfBBhUdMfsEau4aRFenl KiFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700160708; x=1700765508; h=references:in-reply-to:subject:cc:to:date:message-id :content-transfer-encoding:mime-version:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=GK32dK+kRAbEvEN+cIi7x52r6Yj0fd73HOgDmkIVuhw=; b=jP36xfDDyuVE2Rttteev/ny9Jwygh62VcTCq+WJLSZ4kXkTyq8cY9PSD4OVU90uC33 j3Mjeq3QgnNny79n+yG+vMo7gVmK7FHlWk1ShnQuyFPHS0UfhXRgvCs9/bFucLFkJ0L8 ahhAmyPsV4MdJCvSzgPzgRskJ8Rvzb9EFI54FbMqqDXPnofa/fhnVYlvAoeVAGKy6ti1 Eya7tPWfSARs58dxeNcGoDYwj0SLKFCBzJs9vfSKfbvzM1q86QKO6vcPB6OT44GOEAgJ 8flM0qVnfOxEemES8fDfQenA26+1pLQfpTqq7Xb2+BmrpdYidRP4rloE2xTkQDN+208x 69zw== X-Gm-Message-State: AOJu0YzK2uQoYBQjXSujaFUpCLJ/IRJgf0YJhh7oCGmlr0bv1Zkn5Gb5 DzsS9lHwC5Nwtj38V38Ft/EcVZdWI0bAsCudEqT06w== X-Google-Smtp-Source: AGHT+IEs9veZYnBNN4soY/YDk/0ktH3c4g2+ET6NJ7jyQ6HItdD7dV+bFMsh/fkAi3HwZTzbr3fSWg== X-Received: by 2002:a17:902:ced1:b0:1cc:1e16:e998 with SMTP id d17-20020a170902ced100b001cc1e16e998mr10963863plg.51.1700160707662; Thu, 16 Nov 2023 10:51:47 -0800 (PST) Original-Received: from retriever.mtv.corp.google.com ([2620:15c:b5:2:147f:9674:f90a:36a4]) by smtp.gmail.com with ESMTPSA id w13-20020a170902e88d00b001ce5b9ce4fesm2297plg.50.2023.11.16.10.51.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Nov 2023 10:51:46 -0800 (PST) In-Reply-To: <87zfzdcz6z.fsf@posteo.net> X-Mailer: VM 8.1.1 under 30.0.50 (x86_64-pc-linux-gnu) Received-SPF: pass client-ip=2607:f8b0:4864:20::62e; envelope-from=raman@google.com; helo=mail-pl1-x62e.google.com X-Spam_score_int: -197 X-Spam_score: -19.8 X-Spam_bar: ------------------- X-Spam_report: (-19.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, ENV_AND_HDR_SPF_MATCH=-0.5, NICE_REPLY_A=-2.193, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, USER_IN_DEF_DKIM_WL=-7.5, USER_IN_DEF_SPF_WL=-7.5 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:312830 Archived-At: I walked away after seeing what at the time of looking looked like line-noise to me. Now, if debugging that function was my day job, I'd have gone the next step in understanding and answering the question you ask. But given that is not the case, I just moved on. Philip Kaludercic writes: > "T.V Raman" writes: >=20 > > when-let let-alist etc have worked well for me. > > > > What threw me with pcase is there are lots of special chars in tha= t > > particular example whose meaning I dont know, and looking those up= and > > understanding their use at the same time was what chased me away >=20 > Taking the concrete example you mentioned,=20 >=20 > (pcase res > (`(,=5F . ,(and (pred functionp) f)) (funcall f)) > (`(,hookfun . (,start ,end ,collection . ,plist)) >=20 > the unknown or unfamiliar characters are "`" and ",". The (dynamic)= > pcase documentation string is pretty straightforward in explaining w= hat > it does, or can you recall what confused you=3F: >=20 > --8<---------------cut here---------------start------------->8--- > -- `QPAT >=20 > Backquote-style pcase patterns: `QPAT > QPAT can take the following forms: > (QPAT1 . QPAT2) matches if QPAT1 matches the car and QPAT2 t= he cdr. > [QPAT1 QPAT2..QPATn] matches a vector of length n and QPAT1..QPAT= n match > its 0..(n-1)th elements, respectively. > ,PAT matches if the =E2=80=98pcase=E2=80=99 patte= rn PAT matches. > SYMBOL matches if EXPVAL is =E2=80=98equal=E2=80=99= to SYMBOL. > KEYWORD likewise for KEYWORD. > NUMBER likewise for NUMBER. > STRING likewise for STRING. >=20 > The list or vector QPAT is a template. The predicate formed > by a backquote-style pattern is a combination of those > formed by any sub-patterns, wrapped in a top-level condition: > EXPVAL must be "congruent" with the template. For example: >=20 > `(technical ,forum) > --8<---------------cut here---------------end--------------->8--- >=20 > Or if you mean "=5F", then >=20 > --8<---------------cut here---------------start------------->8--- > PATTERN can take one of the forms: >=20 > =5F matches anything. > --8<---------------cut here---------------end--------------->8--- >=20 > which is familiar to people coming from functional languages, but ev= en > Elisp uses underscores to denote unused variables. --=20