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* - cond*-match, cond*-subpat and backtrack-aliases Date: Thu, 1 Feb 2024 09:54:28 -0500 Message-ID: References: <87FCC950-68F3-4BE1-9ADC-FE1AB6C2BEC9@gmail.com> Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3774.300.61.1.2\)) Content-Type: multipart/alternative; boundary="Apple-Mail=_7D2B1740-ED43-49F3-86EF-AEA3BD0AB4F5" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2140"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , emacs-devel To: rms@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 01 15:55:41 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 1rVYTd-0000Ne-0u for ged-emacs-devel@m.gmane-mx.org; Thu, 01 Feb 2024 15:55:41 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rVYSq-0000T7-JF; Thu, 01 Feb 2024 09:54: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 1rVYSi-0000R9-NU for emacs-devel@gnu.org; Thu, 01 Feb 2024 09:54:45 -0500 Original-Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rVYSg-0000ZA-Li; Thu, 01 Feb 2024 09:54:43 -0500 Original-Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-60406f4e1d0so10202307b3.1; Thu, 01 Feb 2024 06:54:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706799280; x=1707404080; darn=gnu.org; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:from:to:cc:subject:date:message-id:reply-to; bh=yg3SelDlD7UQKgMg+rXvSWHtVwwEC5TTq8cLFZCkTtQ=; b=NH/56DV8BX1/a6DX+X4+0NTKmjJuB8vYGJiufjQ1GglvuJHIoFKuGLB4FLxPCAZf83 gNNVsQEw0eMEk1KxSchneUhVaPFfks9V+BufcA+75uagEDf2grN9qT4h3IhJwr+TiySc 4b2tW6CdZJV945oettUgOT27hNW0lnFQU87Tnt7gBzFOhjI17YNGYPWsAwt8IE3kuZNV seZ5uR7oT38hoT64AqWjU4nq3NDyP92IwogT9vhkp8VGA9XDPWyaOi+DNh9H9um0hn2W 50sSS6AduK45Hlb478pIF3FLq0dovF/ct3Dk7NHHua5Z2WXBXSaQXbn0ASNVkf4C6Tqv FlKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706799280; x=1707404080; h=references:to:cc:in-reply-to:date:subject:mime-version:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yg3SelDlD7UQKgMg+rXvSWHtVwwEC5TTq8cLFZCkTtQ=; b=raF+TkKubdMqdNIsqc7q6tz7I5MiUNOa70LjnfHnNBATGxgU3m9LCwanWDJHFoj+dP NQmE5s5xUV62hTaP/X/0Z0+pAxZ4+68G1/Ov5KwLanxIkV9y6wZJk0aJRywoYq/Qwemu P6KSzhi2DTUdFo78Az0DH+TBKEzW5CeMEnFeO3moRv8/1sJMRCpIsQ9PWguLg5PXhJFP uSQK7qW+irk709PzXW5XRVPUFb96yh2+ygxOdIOh4VMmzMjlkIaq5b9LSytm0QinFkPT ZrqA+X6t+c+nKKKPtkCeNMZfz16JA2JW3Nm8HntQJ1lwzQM7TwVjeq9/0MU936ydfCM9 qqeA== X-Gm-Message-State: AOJu0YzI+HfKT2ClZVlpcpFecu0PI53UuHHei6frMvJnGu57oT3NHOmS tcrNvHJB/8TAVeocbmM5EFMrWcABcdVyzQaFqBfATNnjv+FkVAYuxCcWttzm X-Google-Smtp-Source: AGHT+IFMKnfGoT3dL8S4ZaI0w6C2zsda2oYV9erljEeNbo1fyNPjOAGAmqwaTTU9lDsxKGQ6fmjWqw== X-Received: by 2002:a0d:ea4d:0:b0:604:666:4232 with SMTP id t74-20020a0dea4d000000b0060406664232mr2252153ywe.16.1706799279708; Thu, 01 Feb 2024 06:54:39 -0800 (PST) X-Forwarded-Encrypted: i=0; AJvYcCU7ZnN4Cra0oe/FAfMQ7Koz2awy4it6HK3I9Vf8J+PLTVi5ck7sfyvQAqosA5OSZmyCMq6q/W1/sHLAG2RdKdrLTWPy Original-Received: from smtpclient.apple ([131.183.131.33]) by smtp.gmail.com with ESMTPSA id bd3-20020a05690c010300b005ff952f0073sm4349157ywb.11.2024.02.01.06.54.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2024 06:54:39 -0800 (PST) In-Reply-To: X-Mailer: Apple Mail (2.3774.300.61.1.2) Received-SPF: pass client-ip=2607:f8b0:4864:20::112e; envelope-from=jdtsmith@gmail.com; helo=mail-yw1-x112e.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, HTML_MESSAGE=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:315700 Archived-At: --Apple-Mail=_7D2B1740-ED43-49F3-86EF-AEA3BD0AB4F5 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On Jan 31, 2024, at 10:51=E2=80=AFPM, Richard Stallman = wrote: >=20 > [[[ 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. ]]] >=20 >> I wonder why (bind*) evaluates only its first value to determine >> if the binding condition is true? We already have macros which >> evaluate the "truth of a set of bindings": the members of the >> if-let family. And they >=20 >> "Evaluate each binding in turn, as in =E2=80=98let*=E2=80=99, = stopping if a >> binding value is nil. If all are non-nil return the [final] >> value." >=20 > That does not seem natural to me at all. I don't see that it is > better. It's very natural and familiar to users of if/when/and-let (close to = 1000 calls in core packages), since this description is copied verbatim = from their docs. It is a natural way to avoid pre-calculating things = you don't want to calculate until a prior step holds true. =20 A typical logical paths might be: Is some variable non-nil? Is it a plist? Does that plist has a :foobar element? Is that :foobar element's value a vector. Is slot 4 of that vector non-nil? Call it `result'.=20 If all of the above are true, (do-something-with result)= --Apple-Mail=_7D2B1740-ED43-49F3-86EF-AEA3BD0AB4F5 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8

On Jan 31, 2024, at 10:51=E2=80=AFPM, Richard = Stallman <rms@gnu.org> wrote:

[[[ 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. ]]]

I wonder = why (bind*) evaluates only its first value to determine
if the = binding condition is true?  We already have macros = which
evaluate the "truth of a set of bindings": the members of = the
if-let family.  And they

"Evaluate each binding in turn, as in =E2=80=98let*=E2=80=99= , stopping if a
binding value is nil.  If all are non-nil return = the [final]
value."

That does not seem natural to = me at all.  I don't see that it = is
better.

It's very = natural and familiar to users of if/when/and-let (close to 1000 calls in = core packages), since this description is copied verbatim from their = docs.  It is a natural way to avoid pre-calculating things you = don't want to calculate until a prior step holds true. =  

A typical logical paths might = be:

  1. Is some = variable non-nil?
  2. Is it a plist?
  3. Does that plist has a = :foobar element?
  4. Is that :foobar element's value a = vector.
  5. Is slot 4 of that vector non-nil?  Call it = `result'. 
  6. If all of the above are true, (do-something-with = result)
= --Apple-Mail=_7D2B1740-ED43-49F3-86EF-AEA3BD0AB4F5--