From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.devel Subject: Re: [ELPA] New package: hap.el Date: Thu, 2 Mar 2017 15:02:32 +0900 (JST) Message-ID: References: <8760jtgymr.fsf@calancha-pc> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: blaine.gmane.org 1488434603 13802 195.159.176.226 (2 Mar 2017 06:03:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 2 Mar 2017 06:03:23 +0000 (UTC) User-Agent: Alpine 2.20 (DEB 67 2015-01-07) Cc: Nicolas Petton , Tino Calancha , Emacs developers To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Mar 02 07:03:19 2017 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjJpb-00033I-UY for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 07:03:16 +0100 Original-Received: from localhost ([::1]:50571 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjJpi-0006nX-2Z for ged-emacs-devel@m.gmane.org; Thu, 02 Mar 2017 01:03:22 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37534) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cjJp3-0006nK-DD for emacs-devel@gnu.org; Thu, 02 Mar 2017 01:02:42 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cjJoz-00037v-E4 for emacs-devel@gnu.org; Thu, 02 Mar 2017 01:02:41 -0500 Original-Received: from mail-pg0-x242.google.com ([2607:f8b0:400e:c05::242]:36829) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cjJoz-00037f-8a for emacs-devel@gnu.org; Thu, 02 Mar 2017 01:02:37 -0500 Original-Received: by mail-pg0-x242.google.com with SMTP id 25so8205029pgy.3 for ; Wed, 01 Mar 2017 22:02:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=NVW9uCJrsoxlVfuBmRG/RCNqS4LSzcHn1etU5a5Rq2Q=; b=IZ7AdXav8wTF+kGX9xqd0DqPhLx3Ltn86iq+vpMiO8RDf/rwXefGo5u/Pp+vMPUOI6 LjUaCAC4kS9XYeGyNASpw4679kHJy94FemZXaB4lvU8e6vb2idpFSz4HRfjiSlFqRWaj fsHLhDc9RHZxA3tjydWC6KvxiTg5oSv8JfBdUq+fEfxN+EObsFILKiQ1CFo9HqUu3rHz /F4c3/VEtb4OvKS7HHBaaQolv4HOKvZA2jko/gaRFuzc7GCPD0Bkb9BP7Z2evhUH3scm iPu6b/JJiCKQwMuepqlBaxgos7sbhxF4yWVdjLs3a306n+PP09UhD6lOm8Opn0Rh97b6 lj8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=NVW9uCJrsoxlVfuBmRG/RCNqS4LSzcHn1etU5a5Rq2Q=; b=HKROzN8f82eYMl0wggQuFC+cWnDSTIlzpr/+2Md9CRbTKaSDNBDbIe21N01Y24ThAZ kqkDAbYW8fRzCKEoiLPWeB6dkuaX+Jm+5a5QVYIG56Is5ynqpSfXgBI2QuPAvbGdk7qF iPi3Hr24Y9HZlJ5nqKItpvaUz/7UoZwheZ3Icn37OdOnUJyApPiu1b9PrSgk25miUoVo CaEmuEc+4FH9za9uKr8bQW9aNjLj8AARENJ0ba1wuUpRkFIYUdFMyBTsDjyNmJSw4tDN ObKC28b46Bj+PUfXXUsn/9+qVdJ2K+aJIzFIuFLV9D6dGNZuNSk0m+bEBXrWYcEL1B6j coGA== X-Gm-Message-State: AMke39mJtfW97E4sJ7mwr+hirDj8Ji0bebky0qMKaMK5XpoJaePcI7RZeBAu/29ADNFr7A== X-Received: by 10.84.216.17 with SMTP id m17mr1821496pli.158.1488434556172; Wed, 01 Mar 2017 22:02:36 -0800 (PST) Original-Received: from calancha-pc (104.81.147.124.dy.bbexcite.jp. [124.147.81.104]) by smtp.gmail.com with ESMTPSA id m67sm14074753pfj.32.2017.03.01.22.02.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 01 Mar 2017 22:02:35 -0800 (PST) X-Google-Original-From: Tino Calancha X-X-Sender: calancha@calancha-pc In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::242 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:212693 Archived-At: On Wed, 1 Mar 2017, Stefan Monnier wrote: >> It might be convenient to group together under same file all these >> related operations. Thus, I'd like to add this file to Elpa (or Emacs >> core, whatever is appropiate), in case people think it's useful. > > Would it make sense to add this to map.el? That is a good idea. Some part fit well. > At least the conversion between alist and hash-tables is already in > map.el under the name `map-into`. In hap.el, optionally, you can convert from alist to hash table, so that: (let ((map '((1 . a) (1 . foo) (2 . b)))) (equal (alist-get 1 map) (gethash 1 (map-into map 'hash-table)))) => t Maybe map.el might offer same thing. I think that is important. One of the reasons to convert alist to hash table might be that the size of the alist became large. Under such assumption, you might want to use a hash table to do faster queries. In case you have duplicated keys in the alist you'd get the wrong results. We might add a new function `map-equal' that return true when MAP1 and MAP2 have same type and data; for hash tables we might compare the properties as well. > map.el currently doesn't accommodate plists, but maybe that can be fixed > (e.g. by checking (consp (car map)) and/or by adding a few > functions specially designed for plists). We might do plist-get setf-able as it was done for alist-get.