From: Bozhidar Batsov <bozhidar@batsov.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Consider adding hash-keys and hash-values
Date: Sat, 2 Nov 2013 17:27:12 +0200 [thread overview]
Message-ID: <CAM9Zgm1kiO42KpLZEXKfHh9j73zebzU3G5aRnr7RM7CktwZKUQ@mail.gmail.com> (raw)
In-Reply-To: <jwv61sd1s2h.fsf-monnier+emacs@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 298 bytes --]
I've attached a patch for your consideration.
On 31 October 2013 15:37, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
> > Sounds reasonable. Maybe we can use another name, though? Something in
> the
> > lines of `helpers`, `extras`, etc.
>
> I don't have a preference.
>
>
> Stefan
>
[-- Attachment #1.2: Type: text/html, Size: 719 bytes --]
[-- Attachment #2: 0001-lisp-helpers.el-Add-new-library-for-helper-functions.patch --]
[-- Type: application/octet-stream, Size: 2250 bytes --]
From df44b0223a67f519a61a54b39f34014374cd0760 Mon Sep 17 00:00:00 2001
From: Bozhidar Batsov <bozhidar@batsov.com>
Date: Sat, 2 Nov 2013 17:22:33 +0200
Subject: [PATCH] * lisp/helpers.el: Add new library for helper functions
---
lisp/ChangeLog | 4 ++++
lisp/helpers.el | 40 ++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+)
create mode 100644 lisp/helpers.el
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 7716ed1..6558e5d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,9 @@
2013-11-02 Bozhidar Batsov <bozhidar@batsov.com>
+ * helpers.el: Add new functions `hash-table-keys' and `hash-table-values'.
+
+2013-11-02 Bozhidar Batsov <bozhidar@batsov.com>
+
* emacs-lisp/package.el (package-version-join): Recognize
snapshot versions.
diff --git a/lisp/helpers.el b/lisp/helpers.el
new file mode 100644
index 0000000..203a378
--- /dev/null
+++ b/lisp/helpers.el
@@ -0,0 +1,40 @@
+;;; helpers.el --- Some non-essential library extensions
+
+;; Copyright (C) 2013 Free Software Foundation, Inc.
+
+;; Maintainer: FSF
+;; Keywords: convenience
+;; Package: emacs
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;;; Code:
+
+(defun hash-table-keys (hash-table)
+ "Return a list of keys in HASH-TABLE."
+ (let ((keys '()))
+ (maphash (lambda (k v) (setq keys (cons k keys))) hash-table)
+ keys))
+
+(defun hash-table-values (hash-table)
+ "Return a list of values in HASH-TABLE."
+ (let ((values '()))
+ (maphash (lambda (k v) (setq values (cons k values))) hash-table)
+ values))
+
+;;; helpers.el ends here
--
1.8.4
next prev parent reply other threads:[~2013-11-02 15:27 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 14:16 Consider adding hash-keys and hash-values Bozhidar Batsov
2013-10-30 9:36 ` Bozhidar Batsov
2013-10-30 11:06 ` Nathan Trapuzzano
2013-10-30 13:11 ` Stefan Monnier
2013-10-31 12:55 ` Bozhidar Batsov
2013-10-31 13:37 ` Stefan Monnier
2013-11-02 15:27 ` Bozhidar Batsov [this message]
2013-11-03 2:38 ` Leo Liu
2013-11-03 7:28 ` Bozhidar Batsov
2013-11-04 5:14 ` Leo Liu
2013-11-03 14:00 ` Stefan Monnier
2013-11-04 11:47 ` Bozhidar Batsov
2013-11-02 3:05 ` Josh
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=CAM9Zgm1kiO42KpLZEXKfHh9j73zebzU3G5aRnr7RM7CktwZKUQ@mail.gmail.com \
--to=bozhidar@batsov.com \
--cc=emacs-devel@gnu.org \
--cc=monnier@iro.umontreal.ca \
/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.