GNU bug report logs - #79660
30.2.50; let-alist lambdas

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Augusto Stoffel <arstoffel@HIDDEN>; dated Mon, 20 Oct 2025 07:14:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 79660 <at> debbugs.gnu.org:


Received: (at 79660) by debbugs.gnu.org; 20 Oct 2025 11:30:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 20 07:30:05 2025
Received: from localhost ([127.0.0.1]:44301 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vAo5U-0000Ia-Vb
	for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 07:30:05 -0400
Received: from mail.eshelyaron.com ([107.175.124.16]:56796 helo=eshelyaron.com)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <me@HIDDEN>) id 1vAo5S-0000Fh-7O
 for 79660 <at> debbugs.gnu.org; Mon, 20 Oct 2025 07:30:03 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com;
 s=mail; t=1760959800;
 bh=KkJX/G0dguIrEKb0F+fP3T9zRqLNX69cwi9hta24pvQ=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date:From;
 b=MJWwHy7aoB6AiRVmr8GZOoignHQoCC/N+AROzBBm8CHKPo/4CFsxElHRXFpvpM57y
 cnkrMyVCnwyMeqVph0CdvoozvV0w1puBB0eSdw99N4lNLJY5un5giUHv9QaLe29WgE
 0psiBF1RBXJRsFaA9b/o5hPug/MMpU1Vuh7UAo3ohC2dvrkMgTL9HwMqtmoZGxc+le
 SWdKY2AwQM1ZqWlyzO3iBOnDfnp1UNi3l5UvJ5T9ffXRm4KQgbaiz7d+i5RMkmYWna
 jOhVhS+Kx4D/xEOA9BEClFTK5jhH0+l/2N9Ww1vk6DlQGiCYaPB407EtfiP0tcvh7n
 ZQEBFG5Ap7rGg==
From: Eshel Yaron <me@HIDDEN>
To: Augusto Stoffel <arstoffel@HIDDEN>
Subject: Re: bug#79660: 30.2.50; let-alist lambdas
In-Reply-To: <87cy6i2gi6.fsf@HIDDEN>
References: <87cy6i2gi6.fsf@HIDDEN>
Date: Mon, 20 Oct 2025 13:29:55 +0200
Message-ID: <87jz0pbyks.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79660
Cc: Artur Malabarba <emacs@HIDDEN>, 79660 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Augusto,

Augusto Stoffel <arstoffel@HIDDEN> writes:

> When working with lots of alists, I often find myself writing
>
>   (lambda (alist) (let-alist alist BODY))
>
> which, while simple, is pretty cacophonous.  So I'd like to suggest
> adding a little new macro, let-alist-lambda or lambda-alist such that
>
>   (lambda-alist BODY)
>
> expands to the above.

Should this be (lambda-alist ALIST BODY...)?  Or is the intention to
"hardcode" the variable name 'alist' for the alist?

I assume I'm CC'd as the last person to touch let-alist, but actually
I've only investigated it to be able to analyze let-alist forms
correctly in what became elisp-scope.el, so I don't really have any
strong opinions about the proposed addition.  Since I'm already here,
I'll give my hot take: let-alist is currently not robust enough to
implement new constructs on top of it.  (Namely, the code analysis in
let-alist--deep-dot-search suffers from both false negatives and false
positives; I can elaborate if anybody's interested, I just don't want to
derail the discussion from adding a new macro to problems in let-alist.)

That said, lambda-alist seems simple enough that it doesn't introduce
any additional issues, and I see that the pattern it simplifies indeed
already occurs in core Emacs code, so why not? :)


Eshel




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#79660; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 20 Oct 2025 07:13:13 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Oct 20 03:13:13 2025
Received: from localhost ([127.0.0.1]:43333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1vAk4v-000707-BN
	for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 03:13:13 -0400
Received: from lists.gnu.org ([2001:470:142::17]:52480)
 by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.84_2) (envelope-from <arstoffel@HIDDEN>)
 id 1vAk4t-0006zX-17
 for submit <at> debbugs.gnu.org; Mon, 20 Oct 2025 03:13:11 -0400
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 <arstoffel@HIDDEN>)
 id 1vAk4k-0004bx-7f
 for bug-gnu-emacs@HIDDEN; Mon, 20 Oct 2025 03:13:02 -0400
Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <arstoffel@HIDDEN>)
 id 1vAk4h-0006V3-DK
 for bug-gnu-emacs@HIDDEN; Mon, 20 Oct 2025 03:13:01 -0400
Received: by mail-ej1-x631.google.com with SMTP id
 a640c23a62f3a-b3e234fcd4bso690984766b.3
 for <bug-gnu-emacs@HIDDEN>; Mon, 20 Oct 2025 00:12:58 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1760944377; x=1761549177; darn=gnu.org;
 h=mime-version:message-id:date:subject:to:from:from:to:cc:subject
 :date:message-id:reply-to;
 bh=H23PlIuG5Cq36IzdpGWuuICaV9Fv9BddC0bZBBrhYRU=;
 b=TbI9/jnZY7tltqu386e58bZftRM136pJr9u/Jzv8gaoXjuM0KOZsDv72PQVpi8e4/p
 A0zqpBOFQq0npulzyjHn5S2L4VTv7S1BSmiR3/EqYOIrYgZIk9Jz1CK6BpgHJQCozl/O
 1o78wbegDSUofeo4o5HVL0ZYLQbNXrIH0Jy2YwC0KPNAqpcM8wDJk+yKLXrp8jGgQdCF
 zNSHmjrN7JU4qmFpeP2XuUms0QjOycZfComjEHVLgNxHRU+eS1L9rfTb2NgM37BPgWLi
 KV73r95BU+U9ZFP847UA/M0smotgHXh1vkoVNhAABtkZ0o5iSWl8BC/k1yTnFThHG2CS
 olpg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1760944377; x=1761549177;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc:subject:date:message-id:reply-to;
 bh=H23PlIuG5Cq36IzdpGWuuICaV9Fv9BddC0bZBBrhYRU=;
 b=Qtjqq9NNOssUlpHLeqeeH51ct85K50lbKaxcfso3Is8PZj+V3eTHwOUgjggHAamXGQ
 QPa/upwLdAtEd0786QdUg5QjxAkoE9tb/GMVXC7nyNlynS8kIhMFUgVZeQ0amY8XAOpP
 3XyAf1v0IYhU+I4MICgDq19R32T4tTPbdwJAuVCA4MAZjtyxp/AO/OCPfkjz435VDXie
 vCrRHvFap3zTv1O1L5vOZH8EIqFJWu3a+4nQhUMfK5wypNXsOXkRoRMX8w47F9wYxRN7
 e83vseILbCRNzB5eRGN1wGkbfGN55YOwKbesRPLEzojOJXtRqJmJcKt4npLOXKTTytkP
 mAbw==
X-Gm-Message-State: AOJu0YyEO8Do8NVYHoVTh8YuvwRRBOagdZsNsImEkWRgjeB0Oy9LIk6i
 BsipoRt1phjhdq9/7oc7jFJNzvZmtd1VFMi5y8bY2qAgND+Nwent0uYoe9gGIg==
X-Gm-Gg: ASbGncvCiGw/Hsffhg+LIEU59HAfNFM7aNUjOdLsuoY2UaColAxfDP/LVeJvGhPYxhs
 JheozN3mWHCQh6qRZx4JghlFx5BqHy6EqlzCXs2niO0+0eu3TzrDoKoMXEZJwHRw4EwltQwD35O
 hPWPlE/j/NRqSH4t7VR4ipwpHNv5Wm2rfoWY5WB8UWqsDYlQN1kyVoX89ImSV4a0hJQnmqY+KMe
 p6ipoFIww8KEFEwDmMF4XTS7WHYBreSveyQE/ZSCZ5RMXXyp2tQNVhuYs4VZ9ycLTaaYzaj/bOA
 G+wEj7D+R4AO84X5NL4pRjhg75WnME5HwaVZq1cJS1DE7BDrbdPC445e2OiF825fNePaMxC8lhE
 Vfe1ob1MwTTWqaYm3bc3bOyRY/wexsX8vYAwayqDLlK7JqOyzDKQosds6zHYv8AvcgCvgT4jHSd
 7M
X-Google-Smtp-Source: AGHT+IFbyXy4c+zeq+pfiPdb6K0EuriiMUoaxyzzOW6DUQFHiXy3qOzOlk0GmyEUF3Mrvc0vHQdbGA==
X-Received: by 2002:a17:907:9488:b0:b41:12bf:e3aa with SMTP id
 a640c23a62f3a-b6472131b21mr1510374766b.16.1760944369969; 
 Mon, 20 Oct 2025 00:12:49 -0700 (PDT)
Received: from ars3 ([89.246.250.22]) by smtp.gmail.com with ESMTPSA id
 a640c23a62f3a-b65e7da3412sm710997966b.3.2025.10.20.00.12.49
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Oct 2025 00:12:49 -0700 (PDT)
From: Augusto Stoffel <arstoffel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 30.2.50; let-alist lambdas
X-Debbugs-Cc: Artur Malabarba <emacs@HIDDEN>, Eshel Yaron
 <me@HIDDEN>
Date: Mon, 20 Oct 2025 09:12:49 +0200
Message-ID: <87cy6i2gi6.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2a00:1450:4864:20::631;
 envelope-from=arstoffel@HIDDEN; helo=mail-ej1-x631.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 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)

When working with lots of alists, I often find myself writing

  (lambda (alist) (let-alist alist BODY))

which, while simple, is pretty cacophonous.  So I'd like to suggest
adding a little new macro, let-alist-lambda or lambda-alist such that

  (lambda-alist BODY)

expands to the above.  Perhaps entirely superfluously, here are some
examples of how this would be used and looks pretty nice:

Find someone by name in a list of people:

  (seq-some (lambda-alist (equal .name "John"))
            people)

Sort a list of people by age:

  (sort people :key (lambda-alist .age))




Acknowledgement sent to Augusto Stoffel <arstoffel@HIDDEN>:
New bug report received and forwarded. Copy sent to emacs@HIDDEN, me@HIDDEN, bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to emacs@HIDDEN, me@HIDDEN, bug-gnu-emacs@HIDDEN:
bug#79660; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 20 Oct 2025 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.