all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Wilfred Hughes <me@wilfred.me.uk>
To: "Stephen J. Turnbull" <stephen@xemacs.org>
Cc: emacs-devel@gnu.org
Subject: Re: RFC: make maphash return a list
Date: Sun, 5 May 2013 01:06:23 +0100	[thread overview]
Message-ID: <CAFXAjY4e-T+PXUSLoYko0Snzt7yR42VedDx8YpqCyOCOxzVUZw@mail.gmail.com> (raw)
In-Reply-To: <87txmjcnz5.fsf@uwakimon.sk.tsukuba.ac.jp>

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

> 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

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

  reply	other threads:[~2013-05-05  0:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-03 17:59 RFC: make maphash return a list Wilfred Hughes
2013-05-03 23:12 ` Pascal J. Bourguignon
2013-05-04  5:29 ` Stephen J. Turnbull
2013-05-05  0:06   ` Wilfred Hughes [this message]
2013-06-18  8:17     ` Klaus-Dieter Bauer
2013-06-18 15:11       ` Davis Herring
2013-06-18 20:06         ` Klaus-Dieter Bauer

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=CAFXAjY4e-T+PXUSLoYko0Snzt7yR42VedDx8YpqCyOCOxzVUZw@mail.gmail.com \
    --to=me@wilfred.me.uk \
    --cc=emacs-devel@gnu.org \
    --cc=stephen@xemacs.org \
    /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.