Hash tables, anyone?



On 6/8/11, Neilen Marais <nmarais at gmail.com> wrote:
> Robert Dodier <robert.dodier <at> gmail.com> writes:
>> On 7/2/10, Alexander Shulgin <alex.shulgin <at> gmail.com> wrote:
>>
>> > Is it possible to get a reference to a hash table in maxima?
>>
>> Yes: try use_fast_arrays:true $
>> Instead of attaching the hash table to a symbol property,
>> the hash table is put in the value slot of the symbol.
>>
>> The hash table is created the first time an attempt is
>> made to store something in it.
>
> Interesting, that also fixes the use of hash tables for my applicaion. Am I
> alone in wondering why that isn't the default behaviour? The whole hash
> table/symbol property seems like a black magic approach to me while the
> latter  approach seems to be how it works in most modern languages.
> Simply a case of historic precedent?

Well, I think there is a certain tension between name and value
in mathematics. Sometimes it's more convenient to work with
one or the other. For example, let X be an orthogonal matrix with
some specific elements. Let's say sooner or later the product
transpose(X) . X appears. If the value of X is substituted for the
name, then we explicitly carry out the multiplication and get an
identity matrix. But it's more mathematical to remember the
properties of X and say, oh, we can skip a step here, we know the
result is an identity matrix.

Unfortunately Maxima's ability to separate name and value is kind
of confused. But that's the motivation (I'm pretty sure, anyway;
I wasn't around for the first several iterations of Maxima development)
for the distinction between objects which are values and objects
which are properties of symbols.

Hope this clarifies the situation. Best,

Robert Dodier