From: Matt <matt@excalamus.com>
To: "Joost Kremers" <joostkremers@fastmail.fm>
Cc: "help-gnu-emacs" <help-gnu-emacs@gnu.org>
Subject: Re: Navigating Lisp data structures
Date: Tue, 06 Dec 2022 10:36:29 -0500 [thread overview]
Message-ID: <184e814d2b8.11920cbb01394501.3431123481764160723@excalamus.com> (raw)
In-Reply-To: <875yeqfyte.fsf@fastmail.fm>
---- On Sun, 04 Dec 2022 19:46:20 -0500 Joost Kremers wrote ---
> Note that there's also `alist-get`, which should at least help in reducing the
> number of cars and cdrs.
>
> You may also want to check out `let-alist`, which actually gives a nice way to
> access the elements inside a nested alist.
Yes, I had over looked `alist-get` and was unaware of `let-alist`. Thank you.
For posterity, should anyone have similar questions, here's a translation of my nested Python dict into an alist, along with how to access it using `alist-get` and `let-alist`:
(setq project-alist
'((my_c_project .
((shells .
((build .
((root . "/path/to/build/directory/")
(setup . ("export MYBUILDVAR1=1"
"export MYBUILDVAR2=0"))))
(run .
((root . "/path/to/run/directory/")
(setup . ("export MYRUNVAR=1"))))))
(commands . ("./build_my_project.sh"
"./run_my_build"))
(files . ("/path/to/entrypoint.c"
"/path/to/other/file/I/care/about.c"))
(window-split . :quad)))
(my-python-project .
((shells .
((my-python-project .
((root . "/path/to/my/python/project")
(setup . ("source venv/bin/activate"))))))
(commands . ("python3 -m my_python_project"
"python3 -m unittest discover tests/ --failfast --quiet"))
(files . ("/path/to/my_python_project/entry_point.py"))
(window-split . :half)))))
(alist-get 'my_c_project project-alist)
(let-alist project-alist
.my-python-project.shells.my-python-project.root)
next prev parent reply other threads:[~2022-12-06 15:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-04 19:00 Navigating Lisp data structures Matt
2022-12-05 0:46 ` Joost Kremers
2022-12-06 15:36 ` Matt [this message]
2022-12-05 2:05 ` Eric Abrahamsen
2022-12-07 4:06 ` Matt
2022-12-07 18:01 ` Eric Abrahamsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=184e814d2b8.11920cbb01394501.3431123481764160723@excalamus.com \
--to=matt@excalamus.com \
--cc=help-gnu-emacs@gnu.org \
--cc=joostkremers@fastmail.fm \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).