emacs-devel
[Top][All Lists]
Advanced

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

Re: RFC: make maphash return a list


From: Wilfred Hughes
Subject: Re: RFC: make maphash return a list
Date: Sun, 5 May 2013 01:06:23 +0100

> maphash is nice because it doesn't cons a list.

So you're saying that maphash returning nil is a desirable property because it doesn't build a list if you don't want it? OK, I understand. I think it might be helpful for the docstring of maphash to say 'for side effects only' the same way mapc does. My (incorrect) intuition was that any mapFOO function would return a sequence unless otherwise stated.

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

Yep, exactly. I don't want to turn this into bikeshedding -- I only felt it was a nice to have, and of course I can build a list myself. Since both mapcar and mapc exist in core Emacs, would it be worthwhile to have a blessed chose-name-to-taste implementation in core?

> Isn't this [adding functionality to loop] the right place to improve elisp?

That's an excellent idea, I'll try to put together a patch for that.

Thanks for your feedback, I appreciate it.

Wilfred

reply via email to

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