From: Ted Zlatanov <tzz@lifelogs.com>
To: help-gnu-emacs@gnu.org
Subject: Re: plists, alists, and hashtables
Date: Wed, 05 Aug 2015 05:47:42 -0400 [thread overview]
Message-ID: <87d1z2ukw1.fsf@lifelogs.com> (raw)
In-Reply-To: 87614uqn5l.fsf@kuiper.lan.informatimago.com
On Wed, 05 Aug 2015 08:12:22 +0200 "Pascal J. Bourguignon" <pjb@informatimago.com> wrote:
PJB> What you are losing from sight is the fact that:
PJB> - a-lists are lists
PJB> - p-lists are lists
PJB> - lists are sequences
PJB> - lists are cons cells or nil
PJB> therefore any operator working on cons cells, on sequences, on lists,
PJB> can also work on p-lists and on a-lists.
Yes, I think the implicit advantage of everything being a list is well
understood amongst us. But so is the disadvantage of treating
everything as a list. The question is whether hashtables, an existing
ELisp map data type, could become more popular.
PJB> Unfortunately there are many more than 8 datastructures for which you
PJB> could want a specific syntax.
You have to be specific about why we'd discuss or want these 8 data
structures, since the discussion was only about hashtables.
My original question was actually:
> I wonder, if hashtables had a better reader syntax (like plists or
> alists) and better Customize support, would they see wider use? Or is
> the historical baggage in tutorials and existing code too much at this
> point?
Hashtables in Emacs Lisp already have a read syntax, in fact: see
(info "(elisp) Hash Tables")
So maybe if that syntax could be a little less clumsy without breaking
the rest of ELisp, that would help?
For instance, `#s(hash-table)' will evaluate to an empty hashtable
already. But typically you want to control the other parameters, so
this is what `make-hash-table' returns:
#s(hash-table size 65 test eql rehash-size 1.5 rehash-threshold 0.8 data ())
How do we make an easy syntax for that? I see only two major variations
of maps in ELisp; using `eql' or `equal' for keys. I can imagine some
unlikely cases where you'd want other equality comparisons for the keys,
like numeric equality, but I think over 95% of the cases will be covered
by just those two variations.
For instance, and this is just an example:
{{(a . b)}} ; hashtable with test `eql' mapping a to b
{(a . b)} ; hashtable with test `equal' mapping a to b
And finally, if you could Customize hashtables, would that make it
easier to support them as first-class variables in packages? I think
so...
Ted
next prev parent reply other threads:[~2015-08-05 9:47 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-31 21:42 How to iterate over properties in a plist? Marcin Borkowski
2015-07-31 22:18 ` Stefan Monnier
2015-07-31 22:29 ` Marcin Borkowski
2015-07-31 22:42 ` Dmitry Gutov
2015-08-01 13:34 ` Michael Heerdegen
[not found] ` <mailman.7705.1438381807.904.help-gnu-emacs@gnu.org>
2015-07-31 23:33 ` Pascal J. Bourguignon
2015-08-01 22:49 ` Stefan Monnier
[not found] ` <mailman.7750.1438469396.904.help-gnu-emacs@gnu.org>
2015-08-04 10:15 ` plists, alists, and hashtables (was: How to iterate over properties in a plist?) Ted Zlatanov
2015-08-04 10:29 ` Nicolas Petton
[not found] ` <mailman.7809.1438684158.904.help-gnu-emacs@gnu.org>
2015-08-04 11:23 ` plists, alists, and hashtables Ted Zlatanov
2015-08-05 4:36 ` plists, alists, and hashtables (was: How to iterate over properties in a plist?) Rusi
2015-08-05 6:12 ` plists, alists, and hashtables Pascal J. Bourguignon
2015-08-05 9:47 ` Ted Zlatanov [this message]
2015-08-05 12:20 ` Rusi
2015-08-06 19:16 ` Stefan Monnier
[not found] ` <mailman.7892.1438888819.904.help-gnu-emacs@gnu.org>
2015-08-07 16:33 ` Rusi
2015-08-05 17:24 ` Pascal J. Bourguignon
2015-08-05 18:31 ` Ted Zlatanov
2015-08-05 19:30 ` Barry Margolin
2015-08-05 19:40 ` Robert Thorpe
2015-08-05 21:11 ` Pascal J. Bourguignon
2015-08-06 15:17 ` Ted Zlatanov
2015-08-06 18:46 ` Pascal J. Bourguignon
2015-08-06 20:19 ` Drew Adams
2015-08-06 21:08 ` Ted Zlatanov
2015-08-07 0:23 ` Pascal J. Bourguignon
2015-08-06 19:35 ` Stefan Monnier
2015-08-05 13:48 ` Drew Adams
2015-08-06 19:12 ` Stefan Monnier
[not found] ` <mailman.7890.1438888393.904.help-gnu-emacs@gnu.org>
2015-08-06 20:00 ` Pascal J. Bourguignon
2015-08-06 20:57 ` Ted Zlatanov
2015-08-06 21:10 ` Drew Adams
[not found] ` <mailman.7902.1438895429.904.help-gnu-emacs@gnu.org>
2015-08-06 21:15 ` Ted Zlatanov
2015-08-06 21:31 ` Stefan Monnier
2015-08-07 1:53 ` Ted Zlatanov
2015-08-07 7:34 ` Pascal J. Bourguignon
2015-08-07 16:32 ` Stefan Monnier
[not found] ` <mailman.7941.1438965165.904.help-gnu-emacs@gnu.org>
2015-08-08 3:48 ` Pascal J. Bourguignon
2015-08-08 13:42 ` Stefan Monnier
2015-08-08 14:51 ` Rusi
2015-08-07 0:08 ` Pascal J. Bourguignon
2015-08-07 2:14 ` Ted Zlatanov
2015-08-07 7:53 ` Pascal J. Bourguignon
2015-08-07 11:21 ` Ted Zlatanov
2015-08-07 11:47 ` Pascal J. Bourguignon
2015-08-07 17:21 ` Ted Zlatanov
2015-08-07 19:21 ` Stefan Monnier
[not found] ` <mailman.7952.1438975314.904.help-gnu-emacs@gnu.org>
2015-08-08 3:52 ` Pascal J. Bourguignon
2015-08-07 16:35 ` Stefan Monnier
[not found] <mailman.7856.1438803631.904.help-gnu-emacs@gnu.org>
2015-08-05 20:08 ` Ted Zlatanov
2015-08-05 20:45 ` Stefan Monnier
2015-08-05 21:36 ` Drew Adams
2015-08-05 21:41 ` Pascal J. Bourguignon
[not found] ` <mailman.7860.1438807554.904.help-gnu-emacs@gnu.org>
2015-08-06 1:32 ` Ted Zlatanov
[not found] ` <mailman.7862.1438810623.904.help-gnu-emacs@gnu.org>
2015-08-06 1:36 ` Ted Zlatanov
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=87d1z2ukw1.fsf@lifelogs.com \
--to=tzz@lifelogs.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).