On 26 March 2015 at 19:15, Waldek Hebisch <[email protected]> wrote:
> Bill Page wrote:
>> ...
>>  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.

OK.

> 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.

OK.

> BTW: looking at the diff
> I was unable to find implementation of one argument 'table'
> (old one was changed to two arguments)...
>

Please refer to:

On 23 March 2015 at 10:41, Bill Page <[email protected]> wrote:

> @@ -433,11 +440,15 @@
>  function into the representation.
>  )endif
>
> -    table(hashfunction: Key -> SingleInteger): % ==
> +    table(hashfunction: Key -> SingleInteger,eqfunction: (Key,Key) -> 
> Boolean): % ==
>          n: N := arrayLengths 0
>          maxEntries: Z := maxLoad n
>          maxVirtualEntries: Z := maxVirtualLoad n
> -        per [0, maxEntries, 0, maxVirtualEntries, 0, newArr n, hashfunction]
> +        hashfunction := forceLazySlot((hash$Key)@(Key -> I))$Lisp pretend 
> (Key->I)
> +        per [0, maxEntries, 0, maxVirtualEntries, 0, newArr n, hashfunction, 
> eqfunction]
> +    table(hashfunction: Key -> SingleInteger): % ==
> +        table(hashfunction,forceLazySlot((_=$Key)@((Key,Key) -> B))$Lisp 
> pretend ((Key,Key)->B))
> +
>      empty(): % ==
>          table(forceLazySlot((hash$Key)@(Key -> I))$Lisp pretend (Key->I))
>

Thanks.

-- 
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.

Reply via email to