This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: hash-table-for-each, hash-table-map


   X-Authentication-Warning: runyon.cygnus.com: Processed from queue /var/spool/listq
   Date: Wed, 17 Sep 1997 17:38:20 -0400
   From: Russ McManus <mcmanr@eq.gs.com>
   X-Organization: Goldman, Sachs & Co. International Equities Technology
   X-Phone-Number: 212-357-4901
   X-Beeper: 917-556-0708
   Reply-To: russell.mcmanus@gs.com
   Sender: owner-guile@cygnus.com
   Precedence: bulk
   X-UIDL: b139d786117a1d6e8306d440ff2793f3

   i was looking for procedures like 'hash-table-map' and
   'hash-table-for-each' in the guile sources or documentation, and was
   not able to find anything.  am i missing something simple?

   kind regards,
   -russ

   ---
   Hofstadter's Law: It always takes longer than you expect, even when you 
   take into account Hofstadter's Law.

File: slib.info,  Node: Hash Tables,  Next: Hashing,  Prev: Dynamic Data Type,  Up: Data Structures

Hash Tables
===========

  `(require 'hash-table)'

 - Function: predicate->hash PRED
     Returns a hash function (like `hashq', `hashv', or `hash')
     corresponding to the equality predicate PRED.  PRED should be
     `eq?', `eqv?', `equal?', `=', `char=?', `char-ci=?', `string=?', or
     `string-ci=?'.

  A hash table is a vector of association lists.

 - Function: make-hash-table K
     Returns a vector of K empty (association) lists.

  Hash table functions provide utilities for an associative database.
These functions take an equality predicate, PRED, as an argument.  PRED
should be `eq?', `eqv?', `equal?', `=', `char=?', `char-ci=?',
`string=?', or `string-ci=?'.

 - Function: predicate->hash-asso PRED
     Returns a hash association function of 2 arguments, KEY and
     HASHTAB, corresponding to PRED.  The returned function returns a
     key-value pair whose key is PRED-equal to its first argument or
     `#f' if no key in HASHTAB is PRED-equal to the first argument.

 - Function: hash-inquirer PRED
     Returns a procedure of 3 arguments, `hashtab' and `key', which
     returns the value associated with `key' in `hashtab' or `#f' if
     key does not appear in `hashtab'.

 - Function: hash-associator PRED
     Returns a procedure of 3 arguments, HASHTAB, KEY, and VALUE, which
     modifies HASHTAB so that KEY and VALUE associated.  Any previous
     value associated with KEY will be lost.

 - Function: hash-remover PRED
     Returns a procedure of 2 arguments, HASHTAB and KEY, which
     modifies HASHTAB so that the association whose key is KEY is
     removed.

 - Function: hash-map PROC HASH-TABLE
     Returns a new hash table formed by mapping PROC over the keys and
     values of HASH-TABLE.  PROC must be a function of 2 arguments
     which returns the new value part.

 - Function: hash-for-each PROC HASH-TABLE
     Applies PROC to each pair of keys and values of HASH-TABLE.  PROC
     must be a function of 2 arguments.  The returned value is
     unspecified.



-- 
			     -=-=-=-=-=-
I am a guest and *not* a member of the MIT Artificial Intelligence Lab.
      My actions and comments do not reflect in any way on MIT.