unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Consider adding hash-keys and hash-values
@ 2013-10-24 14:16 Bozhidar Batsov
  2013-10-30  9:36 ` Bozhidar Batsov
  0 siblings, 1 reply; 13+ messages in thread
From: Bozhidar Batsov @ 2013-10-24 14:16 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 696 bytes --]

Hi everyone,

I’ve 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’t have them as part of the standard set of hash functions? They are pretty useful and just about every programming language has them in its standard library.

--  
Cheers,
Bozhidar


[-- Attachment #2: Type: text/html, Size: 1273 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2013-11-04 11:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).