From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Matt Newsgroups: gmane.emacs.help Subject: Re: Navigating Lisp data structures Date: Tue, 06 Dec 2022 10:36:29 -0500 Message-ID: <184e814d2b8.11920cbb01394501.3431123481764160723@excalamus.com> References: <184de82cf09.eebfb5c8843687.6482234845227025147@excalamus.com> <875yeqfyte.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29495"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Zoho Mail Cc: "help-gnu-emacs" To: "Joost Kremers" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Dec 06 16:37:29 2022 Return-path: Envelope-to: geh-help-gnu-emacs@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 1p2a0f-0007OH-3s for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 06 Dec 2022 16:37:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p2Zzs-0003Qp-0n; Tue, 06 Dec 2022 10:36:40 -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 1p2Zzp-0003Q5-Sm for help-gnu-emacs@gnu.org; Tue, 06 Dec 2022 10:36:37 -0500 Original-Received: from sender4-op-o12.zoho.com ([136.143.188.12]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p2Zzo-0002lY-3h for help-gnu-emacs@gnu.org; Tue, 06 Dec 2022 10:36:37 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1670340992; cv=none; d=zohomail.com; s=zohoarc; b=Qh0pVoP3qHyQeyCt7VT0Dzh0WI+shChZHqFnjZU4ouTOlhh0FSNMUorqWBEkuQbBaZsfFKaB65vqHfVeEgLPUgTeHGCs7/Ujt3bMhl4k0OOQ0pOCOciNtHb4VMbe9PpEPtuNOtAqn0UQh3qsySL26fSW5jwvJeQHEbaHOpFj460= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1670340992; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=BbLyUUAxF46/8B10/XRIb1+CjVZx/QL0UTE7I5bPV0g=; b=cd2orf3vFet41KDrYlwoDVYEtrIfXAGEQNUwHdXu2kwjQSGwjSShe7K7lvO5Qn/R7mSSctG36EPJnOvngM/1UoV/jJvVK7t7rNIMIod5VrifANU17B0wt52ui9yAYBOagmyj+t33vsmr3kiw6VrodijdtF6YZP91Qq7w+67gsyE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=excalamus.com; spf=pass smtp.mailfrom=matt@excalamus.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1670340992; s=zmail; d=excalamus.com; i=matt@excalamus.com; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=BbLyUUAxF46/8B10/XRIb1+CjVZx/QL0UTE7I5bPV0g=; b=TrImU2mwvLVh/JUIXMwvRIfjVPIxRAAVNcHelmy6OwjJ4QL4phHithsrKZnY/2/O q4w2dstzuLb2oLOE8lGMbwVDi9kpEUiTXop646WUTSRNwLONAZALBy76m3yzbAStnk5 WKGE+ibzwwcRDNCBbehNKHbb1OxjT3/Eewa+4s88= Original-Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1670340989639581.6563713409299; Tue, 6 Dec 2022 07:36:29 -0800 (PST) In-Reply-To: <875yeqfyte.fsf@fastmail.fm> Importance: Medium X-Mailer: Zoho Mail Received-SPF: pass client-ip=136.143.188.12; envelope-from=matt@excalamus.com; helo=sender4-op-o12.zoho.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, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141441 Archived-At: ---- 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)