Oh, I understand now.  With linearSearch, there is no sense
of order, so it is impossible to insert in the middle like
binarySearch.

Yes, those 2 "enterInCache" should not be mixed.

- Qian

On 5/22/26 7:44 AM, Qian Yun wrote:
> There's further logical errors in it:
> 
> If linearSearch fails to find x, then we should insert
> x in the middle of cache, not always insert it at end.
> 
> - Qian
> 
> On 5/22/26 7:20 AM, Qian Yun wrote:
>> On 5/22/26 6:57 AM, Waldek Hebisch wrote:
>>> On Tue, May 19, 2026 at 09:00:47PM +0800, Qian Yun wrote:
>>>> Although this 'enterInCache' is not used in Kernel (the other
>>>> signature is used), this is still a logical error.
>>>>
>>>> Because of the usage of DIFF elsewhere, we can not assume
>>>> "1 + cache_use" is the biggest position.
>>>>
>>>> Instead, we should use logic like elsewhere: bump position
>>>> by DIFF.
>>>
>>> It is not clear to me if we should consider this to be a bug,
>>> AFAICS the intent was to choose and use one of 'enterInCache'
>>> functions, not both together.  And if you really what to
>>> mix them, then adding DIFF is not enough.  Multiplying by
>>> DIFF probably would be enough.
>> It is adding DIFF to the position of last element.
>> Since cache is ordered by position, this will perfectly be fine.
>>
>> - Qian
>>
> 

-- 
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 view this discussion visit 
https://groups.google.com/d/msgid/fricas-devel/5aca6706-c9aa-48c2-aaf9-8f765492d976%40gmail.com.

Reply via email to