From: Tomas Hlavaty <tom@logand.com>
To: Shankar Rao <shankar.rao@gmail.com>
Cc: emacs-devel@gnu.org, "Mattias Engdegård" <mattias.engdegard@gmail.com>
Subject: Re: Is there utility in making hash-table-{keys, values} built-in functions?
Date: Fri, 29 Nov 2024 23:05:37 +0100 [thread overview]
Message-ID: <874j3plmq6.fsf@neko.mail-host-address-is-not-set> (raw)
In-Reply-To: <CAGEgU=g+dGwu+Df1mcg+NdCRUia3FCDWp2JVx+Th7_x+k=-5TQ@mail.gmail.com>
On Fri 29 Nov 2024 at 15:25, Shankar Rao <shankar.rao@gmail.com> wrote:
> while the latter require a lambda, which are generally slower and
> harder to debug.
If that is the case then it would be better to improve the debuger.
>> This means that there is no way to iterate over a hash-table without
>> using a lambda.
Iterating over a hash-table using a callback is not such a problem.
More interesting is that it is not possible to suspend and resume the
iteration. And even more interesting is that it is generally undefined
to change the hash-table inside map-hash callback. hash-tables are
complex objects compared to lists or arrays and map-hash hides a lot of
complexity trying to provide reasonable interface.
Even worse is the lisp interface to list directory,
e.g. directory-files, directory-files-and-attributes,
directory-files-recursively. Here one gets the whole thing as a list
all at once. And the filter is quite limited and not programable. So
if I want something uncommon or faster, an external program is likely a
better choice. Compare that to C/POSIX interface which provides a way
to iterate over the directory. Or maybe instead of worrying about
closing files, a map-hash like interface, e.g. map-directory, would be
better?
next prev parent reply other threads:[~2024-11-29 22:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 11:53 Is there utility in making hash-table-{keys, values} built-in functions? Shankar Rao
2024-11-28 17:31 ` Mattias Engdegård
2024-11-29 14:25 ` Shankar Rao
2024-11-29 22:05 ` Tomas Hlavaty [this message]
2024-11-28 18:40 ` Gerd Möllmann
2024-11-29 13:47 ` Shankar Rao
2024-11-29 14:19 ` Gerd Möllmann
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=874j3plmq6.fsf@neko.mail-host-address-is-not-set \
--to=tom@logand.com \
--cc=emacs-devel@gnu.org \
--cc=mattias.engdegard@gmail.com \
--cc=shankar.rao@gmail.com \
/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.