From: Heime <heimeborgia@protonmail.com>
To: tomas@tuxteam.de
Cc: help-gnu-emacs@gnu.org
Subject: Re: Output an alist from a function
Date: Thu, 26 Sep 2024 08:23:02 +0000 [thread overview]
Message-ID: <n-HdHUYr4MjddMsSmnCOzndp6av4Rsk1ggvidCK6tpkikj3rTs5-7GTUjOlb1Zhldx9zplmj4fI16MDYhhKWIJIg7p1CdOc-oteFd2dNSEY=@protonmail.com> (raw)
In-Reply-To: <ZvTmg0rq8ttDnei7@tuxteam.de>
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:
>
> [...]
>
> > > Maphash "just" iterates over the key-value pairs. The naming is a bit
> > > inconsistent, yes.
> >
> > Recognize the flaws in this school of thought. While it is acknowledged
> > that inconsistencies exist, the proposed solution is always to read more
> > documentation and conduct small experiments to figure things out
> > independently. This approach is highly inefficient [...]
>
>
> 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
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)))
> 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.
> You can try to build your own to get a feel of what's involved. It's
> harder than it seems.
>
> Cheers
> --
> t
next prev parent reply other threads:[~2024-09-26 8:23 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 [this message]
2024-09-26 9:01 ` tomas
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='n-HdHUYr4MjddMsSmnCOzndp6av4Rsk1ggvidCK6tpkikj3rTs5-7GTUjOlb1Zhldx9zplmj4fI16MDYhhKWIJIg7p1CdOc-oteFd2dNSEY=@protonmail.com' \
--to=heimeborgia@protonmail.com \
--cc=help-gnu-emacs@gnu.org \
--cc=tomas@tuxteam.de \
/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.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.