From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ted Zlatanov Newsgroups: gmane.emacs.help Subject: Re: plists, alists, and hashtables Date: Wed, 05 Aug 2015 05:47:42 -0400 Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos Message-ID: <87d1z2ukw1.fsf@lifelogs.com> References: <876150vwaa.fsf@mbork.pl> <873803x5q4.fsf@kuiper.lan.informatimago.com> <87a8u7we9s.fsf_-_@lifelogs.com> <02f81836-554f-4bb4-873b-85c24e080e3d@googlegroups.com> <87614uqn5l.fsf@kuiper.lan.informatimago.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1438768226 31781 80.91.229.3 (5 Aug 2015 09:50:26 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 5 Aug 2015 09:50:26 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Aug 05 11:50:26 2015 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZMvL7-0005HU-KH for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2015 11:50:25 +0200 Original-Received: from localhost ([::1]:39778 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZMvL6-0002wo-W6 for geh-help-gnu-emacs@m.gmane.org; Wed, 05 Aug 2015 05:50:25 -0400 Original-Path: usenet.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!feeder.erje.net!1.eu.feeder.erje.net!news.albasani.net!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 57 Original-X-Trace: news.albasani.net QRMseIAvgJyCB8v1qJZ1SCkGF4OUNZ60w/I34TPWrgj9Y9M1Olz8PW2Jr22PpEIWZrfooQ0UnLYw4PqDQz1FEw== Original-NNTP-Posting-Date: Wed, 5 Aug 2015 09:47:42 +0000 (UTC) Injection-Info: news.albasani.net; logging-data="qhNUMfqFH/8P2blZt6ltVo2tZAj7J5Q1ZxPnFKU3w8nYXE9oG7LMeH5OU3XStPq/Ap4BVYhzJVnKw5hfObASafl6Z5zqkhyDax59hHm8e2AFj4I10hW44bY/5vWLiIVE"; mail-complaints-to="abuse@albasani.net" User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6; d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT= D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx" Cancel-Lock: sha1:7betS9GfBure2umHnLhL03Iw9CM= sha1:KETGNvBC6uOJcdbvREir811T9Y4= Original-Xref: usenet.stanford.edu gnu.emacs.help:213962 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:106247 Archived-At: On Wed, 05 Aug 2015 08:12:22 +0200 "Pascal J. Bourguignon" 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