Even Perl hashes arbitrary values.
In Maxima it should be simple:
Isn't every object a term? So just evaluate this term,
take it as a string, use a standard hash function for
strings, and use bucket hashing.
So do you say that in Maxima you don't have general hash-table
functionality??
But the hash-table from the graphs-package works normally!
It is just that under certain circumstances, which I still
don't understand, it does this annotation business.
For example:
load(graphs);
h : hash_table();
set_hash([1.1],h,5);
set_hash({1},h,10);
set_hash([1],h, 20);
set_hash(7,h,30);
get_hash([1.1],h);
get_hash({1},h);
get_hash([1],h);
get_hash(7,h);
print(h);
Looks all perfectly reasonable to me.
Only under certain circumstances, as this example in my
reply in the original thread shows, Maxima or CLisp (perhaps
the latter) starts distinguishing identical terms.
What is the effect of your change below (I don't know that alike1)?
Will it disable the mostly correct working of that graphs-hash-table
(and I have quite extensive tests running)??
Oliver
On Mon, May 05, 2008 at 04:48:11PM -0400, Raymond Toy (RT/EUS) wrote:
> Andrej Vodopivec wrote:
> > Update of /cvsroot/maxima/maxima/share/contrib/graphs
> > In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv13769
> >
> > Modified Files:
> > graph_core.lisp
> > Log Message:
> > Use alike1 instead of equal in user defined hash tables.
> >
> >
> > Index: graph_core.lisp
> > ===================================================================
> > RCS file: /cvsroot/maxima/maxima/share/contrib/graphs/graph_core.lisp,v
> > retrieving revision 1.15
> > retrieving revision 1.16
> > diff -u -d -r1.15 -r1.16
> > --- graph_core.lisp 25 Apr 2008 13:54:22 -0000 1.15
> > +++ graph_core.lisp 5 May 2008 20:38:42 -0000 1.16
> > @@ -2008,7 +2008,7 @@
> > ;;;;;;
> >
> > (defun $hash_table ()
> > - (make-hash-table :test #'equal))
> > + (make-hash-table :test #'alike1))
>
> You can't use an arbitrary test in a Common Lisp hash table. Some lisps
> will allow you to define your own, but that's not portable.
>
> Ray
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima