unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Miles Bader <miles@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Hash tables
Date: Thu, 11 Sep 2003 18:42:17 -0400	[thread overview]
Message-ID: <20030911224217.GA26720@fencepost> (raw)
In-Reply-To: <16224.62294.152189.23291@nick.uklinux.net>

On Thu, Sep 11, 2003 at 11:12:38PM +0100, Nick Roberts wrote:
> but I want to pass some arguments to gdb-var-operation. I plan to change
> maphash to:
> 
> (maphash FUNCTION TABLE &optional ARGS)
> 
> so that FUNCTION gets called with KEY, VALUE and ARGS.
> 
> This won't be an easy task for me so I'd like some reassurance that its
> a) desirable and b) do-able.

The traditional way of doing this sort of thing in lisp is to bind variables
around the call to maphash, which your function can read (or write), e.g.:

   (let ((extra-info ...)
	 (total sum 0))
     (maphash
      (lambda (key val) 
	(setq total (+ total (calculate-stuff key val extra-info))))
      some-hash-table))

-Miles
-- 
We have met the enemy, and he is us.  -- Pogo

  reply	other threads:[~2003-09-11 22:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-11 22:12 Hash tables Nick Roberts
2003-09-11 22:42 ` Miles Bader [this message]
2003-09-11 22:50 ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030911224217.GA26720@fencepost \
    --to=miles@gnu.org \
    --cc=emacs-devel@gnu.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 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).