[Maxima-commits] CVS: maxima/share/contrib/graphs graph_core.lisp, 1.15, 1.16



Stavros Macrakis wrote:
> On Mon, May 5, 2008 at 4:48 PM, Raymond Toy (RT/EUS)
> <raymond.toy at ericsson.com> wrote:
>>  > Use alike1 instead of equal in user defined hash tables.
>>  > +  (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.
> 
> In GCL at least, (make-hash-table :test #'alike1) correctly gives an error.
> 
> If Lisp allowed arbitrary test functions, how would determine a
> correct hash function?! I suppose a correct, but inefficient, solution
> would be to have all non-standard test functions simply put all values
> in one bucket, reducing to a linear search.

Don't know about other Lisps, but in cmucl, when you define a new hash 
test function, you define the test function as well as a hash function. 
   That info is carried around in the table so Lisp knows how to apply 
the test and the hash function. I guess it's up to the user to make sure 
the test and hash function do something useful for the special hash table.

Ray