[PATCH] misc cleanup recent kl.spad commit

1 view
Skip to first unread message

Qian Yun

unread,
Oct 26, 2021, 2:39:24 AM10/26/21
to fricas-devel
This is a small cleanup on the recent kl.spad commit.
And some doc fixes.

BTW, now "linearSearch" ignores its first argument
completely, shall we change its signature?

I'm glad that commit fixes Kernel soundness and
almost doesn't hurt performance.

- Qian


diff --git a/src/algebra/kl.spad b/src/algebra/kl.spad
index cf19d2dc..54995871 100644
--- a/src/algebra/kl.spad
+++ b/src/algebra/kl.spad
@@ -35,7 +35,7 @@
linearSearch : (S, S -> Boolean) -> Union(S, "failed")
++ linearSearch(x, f) searches x in the cache, calling \spad{f(y)}
++ to determine whether x is equal to y. It returns y from cache
- ++ such that f(y) or failed is no such y exists.
+ ++ if f(y) is true or "failed" if no such y exists.
enterInCache : (S, (S, S) -> Integer) -> S
++ enterInCache(x, f) enters x in the cache, calling \spad{f(x,
y)} to
++ determine whether \spad{x < y (f(x, y) < 0), x = y (f(x, y) =
0)}, or
@@ -44,7 +44,7 @@ SortedCache(S : CachableSet) : Exports ==
Implementation where
binarySearch : (S, (S, S) -> Integer) -> Union(S, "failed")
++ binarySearch(x, f) searches x in the cache, calling
\spad{f(x, y)}
++ to determine order. It returns y from cache
- ++ such that f(y) or failed is no such y exists.
+ ++ if f(x, y) is 0 or "failed" if no such y exists.

Implementation ==> add
shiftCache : (N, N) -> Void
@@ -121,8 +121,6 @@
insertAtEnd(x)
x

- binarySearch(x : S, triage : (S, S) -> Integer) ==
- zero?(cache_use) => "failed"
search_body ==>
vscan := cache
l : Integer := -1
Reply all
Reply to author
Forward
0 new messages