From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Bozhidar Batsov Newsgroups: gmane.emacs.devel Subject: Re: Consider adding hash-keys and hash-values Date: Wed, 30 Oct 2013 11:36:24 +0200 Message-ID: References: <1EA2626D6F9E40C799F18421D8FD41B5@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e013a215a18049b04e9f211ce X-Trace: ger.gmane.org 1383125799 7670 80.91.229.3 (30 Oct 2013 09:36:39 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 30 Oct 2013 09:36:39 +0000 (UTC) To: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 30 10:36:44 2013 Return-path: Envelope-to: ged-emacs-devel@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 1VbSCe-0008VQ-JF for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2013 10:36:40 +0100 Original-Received: from localhost ([::1]:51199 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbSCd-0002iN-ID for ged-emacs-devel@m.gmane.org; Wed, 30 Oct 2013 05:36:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45450) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbSCW-0002hp-8n for emacs-devel@gnu.org; Wed, 30 Oct 2013 05:36:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VbSCP-0007R7-O8 for emacs-devel@gnu.org; Wed, 30 Oct 2013 05:36:32 -0400 Original-Received: from mail-ob0-x235.google.com ([2607:f8b0:4003:c01::235]:61275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VbSCP-0007R2-IK for emacs-devel@gnu.org; Wed, 30 Oct 2013 05:36:25 -0400 Original-Received: by mail-ob0-f181.google.com with SMTP id wp4so1143364obc.40 for ; Wed, 30 Oct 2013 02:36:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:content-type; bh=F+qhyTLaD2LMktgGzX6suV4AnkeFRipcTEsr1V0NwXc=; b=tDOL8bOLeiK98XddhYi2JGSRCVo9l43H6z98/mMsEKLdJZH1ccRHg8UXCVmgrxnJhp jWja7qP81WajWQm4uCSCDpg7bXxbLkQF03TN/fstknZwR6MJNQ1BxomSPruvhyKkxl3k M5SmZB9i8YwE3PcDWzuhJdgCvo5aE58onoyjIOPaZMElpW07JSNVBXfiuR12wcRPreCd 2jtGH0o4MHmZR91pG0YRwCL1JAq9qXCPQIg6+i8IF6gbbeq6hGdDsJlenPDmBTvP/2u0 C2cjxQAi/ktT/1+TpMcGId1FAn7BwyrKFbEzGDux5aktNldBcvlWAnSppnSuq8ijy95m kD4w== X-Received: by 10.182.104.36 with SMTP id gb4mr3428027obb.43.1383125784976; Wed, 30 Oct 2013 02:36:24 -0700 (PDT) Original-Received: by 10.76.131.116 with HTTP; Wed, 30 Oct 2013 02:36:24 -0700 (PDT) In-Reply-To: <1EA2626D6F9E40C799F18421D8FD41B5@gmail.com> X-Google-Sender-Auth: DRNZZGGYxCULF0gyBapNXveFTsY X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c01::235 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 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-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:164683 Archived-At: --089e013a215a18049b04e9f211ce Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Any comments for or against the proposal? Should I could consider your silence a sign of consent and submit a patch? On 24 October 2013 17:16, Bozhidar Batsov wrote: > Hi everyone, > > I=E2=80=99ve seen the following functions (or their equivalents) inlined = in many > packages: > > (defun hash-keys (hashtable) > "Return a list of keys in HASHTABLE." > (let ((keys '())) > (maphash (lambda (k v) (setq keys (cons k keys))) hashtable) > keys)) > > (defun hash-values (hashtable) > "Return a list of values in HASHTABLE." > (let ((values '())) > (maphash (lambda (k v) (setq keys (cons k values))) hashtable) > keys)) > > Is there any particular reason why we don=E2=80=99t have them as part of = the > standard set of hash functions? They are pretty useful and just about eve= ry > programming language has them in its standard library. > > -- > Cheers, > Bozhidar > > --089e013a215a18049b04e9f211ce Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Any comments for or against the proposal? Should I could c= onsider your silence a sign of consent and submit a patch?


On 24 October 2013 17:1= 6, Bozhidar Batsov <bozhidar@batsov.com> wrote:
Hi everyone,
<= div>
I=E2=80=99ve seen the follo= wing functions (or their equivalents) inlined in many packages:

(defun hash-keys (hashtable)
=C2=A0 "Return a list of= keys in HASHTABLE."
=C2=A0 (let ((keys '()))
= =C2=A0 =C2=A0 (maphash (lambda (k v) (setq keys (cons k keys))) hashtable)<= /div>
=C2=A0 =C2=A0 keys))

(defun h= ash-values (hashtable)
=C2=A0 "Return a list of values in HA= SHTABLE."
=C2=A0 (let ((values '()))
=C2=A0 = =C2=A0 (maphash (lambda (k v) (setq keys (cons k values))) hashtable)
=C2=A0 =C2=A0 keys))

Is there any particul= ar reason why we don=E2=80=99t have them as part of the standard set of has= h functions? They are pretty useful and just about every programming langua= ge has them in its standard library.

--=C2=A0=
Cheers,
Bozhidar


--089e013a215a18049b04e9f211ce--