unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: tomas@tuxteam.de
To: Heime <heimeborgia@protonmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Output an alist from a function
Date: Thu, 26 Sep 2024 11:01:34 +0200	[thread overview]
Message-ID: <ZvUi7qErzWChhcVj@tuxteam.de> (raw)
In-Reply-To: <n-HdHUYr4MjddMsSmnCOzndp6av4Rsk1ggvidCK6tpkikj3rTs5-7GTUjOlb1Zhldx9zplmj4fI16MDYhhKWIJIg7p1CdOc-oteFd2dNSEY=@protonmail.com>

[-- Attachment #1: Type: text/plain, Size: 1890 bytes --]

On Thu, Sep 26, 2024 at 08:23:02AM +0000, Heime wrote:
> Sent with Proton Mail secure email.
> 
> On Thursday, September 26th, 2024 at 4:43 PM, tomas@tuxteam.de <tomas@tuxteam.de> wrote:
> 
> > 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 
> 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)))

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.
> > 
> > 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 one
> of his speeches. 

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
-- 
t

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  reply	other threads:[~2024-09-26  9:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-23 21:42 Output an alist from a function Heime
2024-09-24 15:04 ` tomas
2024-09-24 21:28   ` Heime
2024-09-25  4:39     ` tomas
2024-09-25 20:30       ` Heime
2024-09-26  4:43         ` tomas
2024-09-26  8:23           ` Heime
2024-09-26  9:01             ` tomas [this message]
2024-09-26 20:58               ` Heime
2024-09-24 16:19 ` Stephen Berman

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=ZvUi7qErzWChhcVj@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=heimeborgia@protonmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).