In Perl, not in MUMPS. MUMPS arrays are more complex, allowing nodes to have both values and children. Hashes in Perl only associate a value (which may be a reference) to each key (subscript).

In general, a hash is an algorithm that computes a number from an object of some type in such a way that it is unlikely (not impossible) for different objects to have the same has value. If you think of an array with numeric subscripts, it is easy to locate the ith element of the array in memory. Bear in mind that this is not something programmers usually need to do, the compiler just takes base address of the array and adds 4 time i (assuming a word size of 4). The programmer just writes a[i] (in C or Pascal) and doesn't have to worry about the internals. But this scheme doesn't work for languages like MUMPS that allow strings as subscripts. There are various possible implementation strategies, one of which is to compute a hash of the subscripts that the integer used to look up the value. Another strategy would be to organize the array nodes into a treelike structural (called a binary heap) where you basically make a series of lookups based on the collating sequence of the subscript (i.e., where it falls in "alphabetical order"). This can require a lot of memory references, and memory references are VERY slow, but a strategy called caching, where recently accessed values are stored for fast lookup. Unlike the data structure I described before, this kind of caching is typically done in hardware, but there are software caches, too, and it's software caches that makes global references in MUMPS fast.
===
Gregory Woodhouse
[EMAIL PROTECTED]

"The whole of science is nothing more than a refinement
 of everyday thinking."  -- Albert Einstein


On Aug 24, 2005, at 4:01 PM, James Gray wrote:

Very good. However, I still do not understand hash tables or hashes. Does the % in front of the a make it a hash?

Jim Gray




-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to