1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-06 14:30:50 -08:00

Document and test 'let-alist' support for indexing

* etc/NEWS: Announce 'let-alist' support for indexing.
* test/lisp/emacs-lisp/let-alist-tests.el (let-alist-numbers):
Add a test for 'let-alist's support for indexing.
* doc/lispref/lists.texi (Association Lists): Document indexing
with 'let-alist'.  (Bug#66509)
This commit is contained in:
Spencer Baugh 2025-08-28 15:04:39 -04:00 committed by Eli Zaretskii
parent 7efaa4657a
commit b610f36d44
3 changed files with 30 additions and 0 deletions

View file

@ -100,4 +100,15 @@ See Bug#24641."
`[,(+ .a) ,(+ .a .b .b)])
[1 5])))
(ert-deftest let-alist-numbers ()
"Check that .num indexes into lists."
(should (equal
(let-alist
'(((a . val1) (b . (nil val2)))
(c . (val3)))
(list .0 .0.a .0.b.1 .c.0))
;; .0 is interpreted as a number, so we can't use `let-alist'
;; to do indexing alone. Everything else works though.
'(0.0 val1 val2 val3))))
;;; let-alist-tests.el ends here