From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: JD Smith Newsgroups: gmane.emacs.devel Subject: Re: Code for cond* Date: Wed, 24 Jan 2024 11:20:38 -0500 Message-ID: <5079C75B-D729-4732-8C87-DA2DE4FA2BDE@gmail.com> References: <1AD5807F-91F7-4B92-BCB0-D0FEA904A75D@gmail.com> <8E0D0E7B-B733-4CB7-A34D-7FE80D3AB52D@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) 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="16622"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Stefan Kangas , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jan 24 17:21:53 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 1rSg0f-00047O-4U for ged-emacs-devel@m.gmane-mx.org; Wed, 24 Jan 2024 17:21:53 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rSfzi-0000e6-RZ; Wed, 24 Jan 2024 11:20:54 -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 1rSfzg-0000bx-RS for emacs-devel@gnu.org; Wed, 24 Jan 2024 11:20:52 -0500 Original-Received: from mail-yb1-xb2f.google.com ([2607:f8b0:4864:20::b2f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rSfzf-00085x-9x for emacs-devel@gnu.org; Wed, 24 Jan 2024 11:20:52 -0500 Original-Received: by mail-yb1-xb2f.google.com with SMTP id 3f1490d57ef6-dbed0710c74so5137830276.1 for ; Wed, 24 Jan 2024 08:20:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706113250; x=1706718050; darn=gnu.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=MHoXXCJmzR5HMIW50pKd6LfDuLTfFJZuHXwkd9HWYOY=; b=EaSQ4+EbKmPaJ3H0SZIiY+ke39XUTQzWyzlOuWOt8zTiQXTzGs/lAOT/QrUjfeb9AI y8imP6mDoZ1AFuO28tUezL0i+FODQ7rSIfaoRgFFKR352GEbjZlkatpALakqs1CnTvSh eEDy78HQaTrh+kTXiTpYkB5pRw8+btQNH30pCN+9Z0yHd/KWOrfFyuMMfHUcbHgMnQh7 wbIYzNGxxTxfWujQ4GDWwUmcSCYfE116ojjg2vOr0KSky4x0p+XFcxs5XR2E7CL3Zpu8 KIjdoMwEyrd02oQXDGeafHok7HNigE10vYfhiB+nYrlm+doA5av4y8/bPFOOw4LKlLPg oobQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706113250; x=1706718050; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MHoXXCJmzR5HMIW50pKd6LfDuLTfFJZuHXwkd9HWYOY=; b=vKs+NN4Uoiqrepvnlp4DfQfuBVHUinZDN5hViNkOjKdZU1fXF2hp4v/+pkhJ1u0ccN EnGwNrhM7ZvM4PGtuao/EmmJJTvgedzgvEDQFTVGlvPdO0f/LUrsYkfv3Go15G2SWg/T 2Rh8LOK5KYfMTCkKSmfptRUqsKrOZbSLlIzmJ+ffgY+y6TmewPph2lMelSiWsC2bM/O8 xPvq3T65Y7X4p/QnuACDIDhlPwhwHwfZzP23Y43ll8WOhAusczFyp6dEfmxcjnsGEd32 XJ7VD2kNW71cb0BiBozHCeGLHcL8YP5YgSg+HXFlhTkp8jVFnjVoeGdxlpGotV0VOrC8 hTGw== X-Gm-Message-State: AOJu0Yzm/b1Q3CCLabaG+gEy8ttFLphCgHMHh4CtaxIwUEGPJNyZdu47 lOOmKhMHb61XFBCFudvO5uhE38F4OY6Y++xMwcZAHwRYB2vSR6yha+T62R1v X-Google-Smtp-Source: AGHT+IGfTctiozySZhxMi+6UhEtJY5IolDlD6C6W98dV+pOb1HzPiNOdiOmPdGiLaW6LR4C2G/GVug== X-Received: by 2002:a25:f212:0:b0:dbd:4c4d:240d with SMTP id i18-20020a25f212000000b00dbd4c4d240dmr804408ybe.59.1706113250233; Wed, 24 Jan 2024 08:20:50 -0800 (PST) Original-Received: from smtpclient.apple ([131.183.131.33]) by smtp.gmail.com with ESMTPSA id q4-20020a5b0344000000b00dbd15c3b753sm2855001ybp.46.2024.01.24.08.20.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2024 08:20:49 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3774.300.61.1.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::b2f; envelope-from=jdtsmith@gmail.com; helo=mail-yb1-xb2f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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:315321 Archived-At: > On Jan 24, 2024, at 10:55=E2=80=AFAM, Stefan Monnier = wrote: >=20 >> To explain this correctly, I=E2=80=99d need to understand where the = mental >> model breaks down. For example, I was surprised that this >> forward/reverse symmetry was not maintained: >>=20 >> (let ((list-var '(foo moo loo)) >> (other 'boo)) >> `(,@list-var . ,other)). ; -> (foo moo loo . boo) >>=20 >> (pcase '(foo moo loo . boo) >> (`(,@list-var . ,other) >> (format "Got %S: %S" list-var other))). ; -> nil, expected =E2=80=9CG= ot (foo moo loo): boo" >=20 > Note that >=20 > (let ((list-var '(foo moo)) > (other '(loo . boo))) > `(,@list-var . ,other)) >=20 > returns the same `(foo moo loo . boo)`, so there is not a unique way = for > a pattern like `(,@list-var . ,other) to match a given list. > That's a large part of the reason why ,@ is not supported in Pcase's > backquote patterns. Not a unique way without a policy, but could it not take the largest = possible list at that position, ala regexp greedy matching? Any other forward/reverse asymmetries you are aware of (other than the = use of meaningful sub-lists with symbols like pred/and/or/guard for = pcase to interpret)?=