From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Richard Stallman Newsgroups: gmane.emacs.devel Subject: Re: Code for cond* Date: Wed, 14 Feb 2024 06:16:01 -0500 Message-ID: References: Reply-To: rms@gnu.org Content-Type: text/plain; charset=Utf-8 Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="18045"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Feb 14 12:22:59 2024 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 1raDLu-0004RF-Qu for ged-emacs-devel@m.gmane-mx.org; Wed, 14 Feb 2024 12:22:58 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1raDFR-0005i4-C5; Wed, 14 Feb 2024 06:16:17 -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 1raDFC-0005Fz-Qv for emacs-devel@gnu.org; Wed, 14 Feb 2024 06:16:03 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1raDFB-0007NA-UY; Wed, 14 Feb 2024 06:16:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=Date:References:Subject:In-Reply-To:To:From: mime-version; bh=HdnHMT72cgiwvip4u7dmuQ+bNqpb584Lz1CmwjZajGI=; b=TI8HPhYlioKP dVxW24cR3DhNvKehRZlXA6jPW8xpdfZ7f7SRpUnE9zEO3hIMrwPCQt2CFoQGgfqhOgZWbAY7rhEUO /5NgYDLfeYAlF2qjNOTORBjffzE6V9oqRo04rXtSXU/NZ9iFVw7hw9pj/hfzHpnk/b5CvkTWxCroz J6d0gY7ezfcRXejTtjiC+wqs8iStTunlVLVGQwnl1qc7FWxUlTmicPCNhFQgZ2D+/m3hByi1QF6D7 jVnUz8GWsxXqew7vcDCjNVKrEwz52/5cdcgrD5+3A+gp3GLAE/LTD5ygeym/OAfPDb9py/XLZ/cVn KFgSWqSjBlxBLCse75uqqA==; Original-Received: from rms by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1raDFB-0003qa-9n; Wed, 14 Feb 2024 06:16:01 -0500 In-Reply-To: (message from Stefan Monnier on Mon, 12 Feb 2024 19:48:55 -0500) 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:316199 Archived-At: [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > That still doesn't clarify its meaning. > E.g. I understand that `(head ,b) should match (head 1 2), but what > about matching a value like (head) ? > The code I have found so far makes it not match (head). That is right. `(head ,b) insists there must be two elements in the list, and binds b to the second element. The ignore-cdrs flag has no effect on that. This flag affects only cdrs which are nil in the pattern. What it affects is whether `(head ,b) can match longer lists such as (head foo bar) -- whether the pattern demands that the cddr be nil to match. I had this idea when I saw ` . ,_' at the end of lists in several pcase patterns. Its current meaning is the right meaning. I believe that it IS documented in these lines. (cdr PATTERN) matches PATTERN with strict checking of cdrs. That means that `list' patterns verify that the final cdr is nil. Strict checking is the default. (cdr-safe PATTERN) matches PATTERN with lax checking of cdrs. That means that `list' patterns do not examine the final cdr. -- Dr Richard Stallman (https://stallman.org) Chief GNUisance of the GNU Project (https://gnu.org) Founder, Free Software Foundation (https://fsf.org) Internet Hall-of-Famer (https://internethalloffame.org)