On 03/23/2015 03:41 PM, Bill Page wrote: > The following patches provide hashUpdate! and as a result hash > functions to the Expression, Kernel, Float and Complex domains.
Looks OK to me. And if these domains export SetCategory (which is true) there should be an implementation of hashUpdate!. > 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. I see what you are aiming at, but I'm not sure whether I should support your particular patch. Anyway, hashUpdate! has nothing to do with XHashTable. So if your stuff is accepted, it should be two separate commits. However, if you modify the code to allow an eqFunction in a table construction, then I see no reason to require the Key parameter http://fricas.github.io/api/XHashTable to be of type SetCategory. The export of table: (Key -> I) -> % could be made conditional "if Key has SetCategory then ...". In fact, it seems you would like to construct E ==> Expression Integer T ==> XHashTable(E, ENTRY) and then create the table with t: T := table(hash$E, eq) but which function eq (other than =$E) would make sense in that place? If you use =$E and have two expressions e1 and e2 (with e1=e2) that have different representation, then storing some entries with keys e1 and e2 will (most probably) give 2 table entries since hash(e1) will be different from hash(e2). Your specification says that for that case you would simply consider e1 and e2 not equal with respect to the given eq function. So that would also give two table entries. This sounds like it would make more sense creating a domain ExpressionRep(X: ...) that exports the equality from the underlying representation and then define Expression(X: ...): ... == ExpressionRep(X) add Rep := ExpressionRep(X) ((x: %) = (y: %)): Boolean == (x - y) =$Rep 0 Then you are able to use XHashTable(ExpressionRep(X), ENTRY) and use =$ExpressionRep(X). I'm somehow missing some concrete use case to find you patch to XHashTable useful. Ralf -- 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.
