From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: tomas@tuxteam.de Newsgroups: gmane.emacs.help Subject: Re: Output an alist from a function Date: Thu, 26 Sep 2024 11:01:34 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="wMGT6JldSe26fRjS" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="30901"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 26 11:02:29 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 1stkOK-0007sz-G4 for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 26 Sep 2024 11:02:28 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1stkNg-0006Jz-IW; Thu, 26 Sep 2024 05:01:48 -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 1stkNY-0006J9-JE for help-gnu-emacs@gnu.org; Thu, 26 Sep 2024 05:01:41 -0400 Original-Received: from mail.tuxteam.de ([5.199.139.25]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1stkNW-00071U-OT for help-gnu-emacs@gnu.org; Thu, 26 Sep 2024 05:01:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tuxteam.de; s=mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject :Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=FyFRFUIRmXJ1HVC/6bmaMkRC2u3nC9PNE7w0qrxLxQc=; b=kRuvr5l4rrqpHLW1Ewz6iG/tBM iLcr+oYG1qLIdkEQZm7mHfIZPb/zcgffXmp2JF08TMEPUCRUNRy2uu4wuUwhxqlyauORVrqVSc/Nn GP1nigLWurFGwE+U7aPrH29uePqcBefS7iYdzrj+9xKaEX/XbbsJ08n6uRnG/VZexS/Fp4qvAvb3u wByWPN/HJzBEV1Wnvcbzbn+QOX/f3hPxakqjSgc9qbEpSFIIpnlvXnhINb3pY/txbZKaI8rHykLQo IQNR9P2pEunUjUaP9YGLW9pa85vMn6ZggD6NE9K+NpF3XoqxFuDCWAo/1TRhhNVOgse4IfGaS8emu lOMH43mQ==; Original-Received: from tomas by mail.tuxteam.de with local (Exim 4.94.2) (envelope-from ) id 1stkNS-0000vf-Uz; Thu, 26 Sep 2024 11:01:35 +0200 Content-Disposition: inline In-Reply-To: Received-SPF: pass client-ip=5.199.139.25; envelope-from=tomas@tuxteam.de; helo=mail.tuxteam.de 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_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=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:148071 Archived-At: --wMGT6JldSe26fRjS Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 26, 2024 at 08:23:02AM +0000, Heime wrote: > Sent with Proton Mail secure email. >=20 > On Thursday, September 26th, 2024 at 4:43 PM, tomas@tuxteam.de wrote: >=20 > > On Wed, Sep 25, 2024 at 08:30:30PM +0000, Heime wrote: [...] > For what I am doing, the problem is not acute and with your suggestion=20 > towards mapc, I made >=20 > ;; 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))) If all you need is to print a formatted rendering of the alist/hash, perhaps you can skip the generation of an intermediate data structure? (I don't know what your greater plan is, so perhaps that musing is irrelevant) > > 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). >=20 > It is as Guy Steele used to describe a programming language. I attended = one > of his speeches.=20 After all, programming languages are also human languages, with all their cultural traits, tribalities, identity facets, yadda, yadda. Had I the choice today, I'd study programming language anthropology. Cheers --=20 t --wMGT6JldSe26fRjS Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRp53liolZD6iXhAoIFyCz1etHaRgUCZvUi6AAKCRAFyCz1etHa Rm0/AJ9FMzAG2r9FfoCBENTkxLq+L5yCxwCeN5oryxIGVNgTnWXqmzIDjBT/QIQ= =KWkW -----END PGP SIGNATURE----- --wMGT6JldSe26fRjS--