On Tue, Mar 20, 2012 at 03:15:41PM +0100, Waldek Hebisch wrote:
> Serge D. Mechveliani wrote:
> > 
> > On Mon, Mar 19, 2012 at 06:24:07PM +0100, Waldek Hebisch wrote:
> > > Ralf Hemmecke wrote:
> > > > 
> > > > Personally, I tend to agree that there should be a hashtable that does 
> > > > not impose SetCategory on its second argument. Of course, one cannot 
> > > > output such a table, but maybe the user doesn't want output anyway.
> > > >
> > > 
> > > SetCategory is not very important, but BasicType (that is equality)
> > > is crucial.
> > 
> > 
> > It is desirable to understand how this `=' is used for the second 
> > (Entry) argument in the operations `search' and `insert!'.
> 
> Not used at all.  I meant equality of keys.  AFAICS SetCategory
> for Entry is used to define bunch of extra functions which
> are uninteresting to you.  In fact, we probably should not
> require SetCategory for Entry and define those functions
> only conditionally.

Yes.


> > For  HashTable,  I cannot tell what may be (in my example), for example, 
> > the cost of `insert!'.
> [..]
> > Meanwhile, I use HashTable. But in future I shall need to rewise its
> > usage, for the thing may ruin the performance.
> 
> As I wrote, there are limitations on types of keys.  Basically,
> if you have record with more than two components or an
> array inside the keys, then it will not work.  

I hope that                 Key := Integer  
is enough for my purpose.  

> AFAICS your ConstructedDomain contains Type inside.  This
> is tricky case, it will work most of the time but is not
> guaranteed to always work.  Basically, as optimization FriCAS
> runtime tries to construct given type only once.  This
> is done by keeping a cache of already constructed types.
> But size of cache is limited and if you construct so many types
> that you overflow the cache then FriCAS may construct the
> same type second time.  Technically it means that most of
> the time Lisp EQ function will correctly compute equality
> of types, but it type is constructed second time EQ will
> return false and one needs to use more complicated function
> to establish equality.  
> [..]

I have  HashTable(Key, Entry),  
where   Key := Integer;  Entry := ConstructedDomain.

And from your above notes I conclude that `search' and `insert!' 
certainly _will not_ apply equality to any part of  ConstructedDomain.
On the other hand, Axiom insists on declaring SetCategory for 
                                                     ConstructedDomain. 
Also I need "=" for ConstructedDomain  for the 
                                           _needs other than HasTable_. 
Its implementation needs to be like this: 
build from   cd : ConstructedDomain  a certain symbolic representation  
descr : InputForm,  and put  cd = cd' == descr(cd) = descr(cd').
This  descr  is something instead of  SExpression.
It may have a considerable cost,
and I hope that `search' and `insert!' for
                                   HasTable(Integer, ConstructedDomain)
_will not_ involve applyig this "="  for ConstructedDomain.  

> So it seems that you can not use your ConstructedDomain as
> HashTable keys.

ConstructedDomain  is used for  Entry,  not for  Key.

Thanks,

------
Sergei
[email protected]

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/fricas-devel?hl=en.

Reply via email to