emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFC: make maphash return a list


From: Stephen J. Turnbull
Subject: RFC: make maphash return a list
Date: Sat, 04 May 2013 14:29:02 +0900

Wilfred Hughes writes:

 > I've been using Emacs hash tables a lot recently, and I would find
 > several operations much easier if maphash returned a list. For
 > example, I'd like to be able to do:
 > 
 > (maphash (lambda (key value) key) some-table)

(defun choose-name-to-taste (callable table)
  "Left as an exercise for the reader."
  (let ((retlist nil))
    (maphash (lambda (key value)
               (setq retlist (cons (funcall callable key value) retlist)))
             table))
    retlist))

 > Is there interest in this?

Please don't, for the reasons given in other replies.

 > However, unlike elisp, Common Lisp's loop macro supports iterating
 > over keys directly with (loop for key being hash-key of some-table
 > ...) which helps considerably.

Isn't this the right place to improve elisp?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]