From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Heime Newsgroups: gmane.emacs.help Subject: Re: Output an alist from a function Date: Thu, 26 Sep 2024 08:23:02 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33559"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: tomas@tuxteam.de Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 26 10:23:51 2024 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 1stjmw-0008YR-Nm for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 26 Sep 2024 10:23:50 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stjmM-0007T1-4K; Thu, 26 Sep 2024 04:23:14 -0400 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 1stjmJ-0007Se-F2 for help-gnu-emacs@gnu.org; Thu, 26 Sep 2024 04:23:11 -0400 Original-Received: from mail-43166.protonmail.ch ([185.70.43.166]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stjmH-0002QW-40 for help-gnu-emacs@gnu.org; Thu, 26 Sep 2024 04:23:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1727338987; x=1727598187; bh=H+rdjksAbMXkdeFyuPuM5liVFFj7uZnhlWe9i9a09eU=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=S1Tsz1z0tclYYq9nWhyLoP0AvLnk+7WIqopwk5AauO4rm+vv+cM/cd5SU2ltauKKn uT80e9+5MgxHj5x5TD3so2MNlhkSr6B+pkY7sEbi42ktWmXotiqC8jMRk5FDe3H97E jyf+o6LdAkQ4crmweEQpOHIgBEwVj1AIRVmAr33rJKfUwB/owOP7f22+2sMA85hxss kFXu4pdarlxdM+usZXRm3ZD8W6JA8yZGLvHUVtedfUhPXZdsL8RgVP5EwzN53Oh4TS 5yCkQcNXk8nnphTFeWlVaIGtYfnAW6rd1ZNX61eCRZ9jt4eMSvmo00I6wI2vb3+2Rp 9ZiVjLXDo/WVA== In-Reply-To: Feedback-ID: 57735886:user:proton X-Pm-Message-ID: 7efb666d46ccc18d06e520fc7e5d457599be881a Received-SPF: pass client-ip=185.70.43.166; envelope-from=heimeborgia@protonmail.com; helo=mail-43166.protonmail.ch 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_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_PASS=-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:148070 Archived-At: Sent with Proton Mail secure email. On Thursday, September 26th, 2024 at 4:43 PM, tomas@tuxteam.de wrote: > On Wed, Sep 25, 2024 at 08:30:30PM +0000, Heime wrote: >=20 > [...] >=20 > > > Maphash "just" iterates over the key-value pairs. The naming is a bit > > > inconsistent, yes. > >=20 > > Recognize the flaws in this school of thought. While it is acknowledged > > that inconsistencies exist, the proposed solution is always to read mor= e > > documentation and conduct small experiments to figure things out > > independently. This approach is highly inefficient [...] >=20 >=20 > This may apply when you're designing a new system. On an old system, > with nearly 40 years of history and lots of dependencies, there are > limits to how quickly you can change things without breaking programs > and users you haven't ever heard of. For what I am doing, the problem is not acute and with your suggestion=20 towards mapc, I made ;; Initialize an empty alist to hold output (let ( (output-alist '()) ) ;; `mapc' iterates over an alist in a manner similar to how ;; `maphash' processes a hash table. (mapc (lambda (entry) (let ( (waypt (car entry)) (dir-path (cdr entry)) ) ;; Push the result to the front of the output alist (push (cons waypt (not (file-directory-p dir-path))) output-alist))) fpln) ;; Reverse the list to maintain the original order (reverse output-alist))) =20 > You'll always have inconsistencies. Removing them is an ongoing process > which happens very carefully, and is in a steady state wrt introducing > new ones. >=20 > At this stage, the evolution resembles that of human languages (which > do have their sets of inconsistencies). It is as Guy Steele used to describe a programming language. I attended on= e of his speeches.=20 =20 > You can try to build your own to get a feel of what's involved. It's > harder than it seems. >=20 > Cheers > -- > t