emacs-devel
[Top][All Lists]
Advanced

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

Re: Hash tables


From: Miles Bader
Subject: Re: Hash tables
Date: Thu, 11 Sep 2003 18:42:17 -0400
User-agent: Mutt/1.3.28i

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 via email to

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