Bill Page wrote:
> Also
> included is a patch to XHashTable to optionally pass a user specified
> function representing equality in the key domain. This is important
> for the use of XHashTable in domains like Expression where equality is
> not canonical.
>
> Index: src/algebra/xhash.spad
> ===================================================================
> --- src/algebra/xhash.spad (revision 1893)
> +++ src/algebra/xhash.spad (working copy)
> @@ -89,6 +89,7 @@
> N ==> NonNegativeInteger
> Z ==> Integer
> I ==> SingleInteger
> +B ==> Boolean
>
> )if LiterateDoc
> Let us now discuss the overall domain implementation.
> @@ -102,7 +103,7 @@
> ++ Keywords: hash table
> ++ Description:
> ++ An implementation of a hash table that uses equality of the key domain
> -++ to decide upon equality of keys.
> +++ or a user specified function to decide upon equality of keys.
> XHashTable(Key: SetCategory, Entry: Type):
> Join(TableAggregate(Key, Entry), finiteAggregate, shallowlyMutable) with
> table: (Key -> SingleInteger) -> %
> @@ -111,6 +112,10 @@
> ++ the sense that from k1=k2 follows h(k1)=h(k2). If that is not
> ++ the case, k1 and k2 will internally be considered as being
> ++ different keys.
> + table: (Key -> SingleInteger,(Key,Key) -> Boolean) -> %
> + ++ table(h,eq) creates an empty hash table that uses eq instead
> + ++ of the "=" from the Key domain. Note that h and eq must be
> + ++ compatible in the sense that h(k1)~=h(k2) -> not eq(k1,k2)
> == add
> KE ==> Record(key: Key, entry: Entry)
> UE ==> Union(Entry, "failed")
I only now looked more carefully at this part. Since we already
have hash function as argument passing also equality is IMO
quite reasonable. As was mentioned, if we get hash and equality
as argument we do not need SetCategory. So I think that
Key should be just Type and single argument 'table' should
be conditional on SetCategory. BTW: looking at the diff
I was unable to find implementation of one argument 'table'
(old one was changed to two arguments)...
--
Waldek Hebisch
[email protected]
--
You received this message because you are subscribed to the Google Groups
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.