[PATCH] fix function "hash" for List

6 views
Skip to first unread message

Qian Yun

unread,
Aug 26, 2021, 5:23:58 AM8/26/21
to fricas-devel
Currently "hash" gives error for List, like:

(1) -> hash [1]

>> System error:
The value
1
is not of type
CONS

The reason is that "Qfirst" in following patch is
a Lisp function without type, so compiler assumes
its type to be '%' instead of "S".

diff --git a/src/algebra/list.spad b/src/algebra/list.spad
index e3d19e51..c4c7a0d1 100644
--- a/src/algebra/list.spad
+++ b/src/algebra/list.spad
@@ -173,7 +173,7 @@ List(S : Type) : Exports == Implementation where

hashUpdate!(s : HashState, x : %) : HashState ==
while not empty? x repeat
- s := hashUpdate!(s, Qfirst x)
+ s := hashUpdate!(s, Qfirst x)$S
x := Qrest x
s

Waldek Hebisch

unread,
Aug 26, 2021, 8:56:31 AM8/26/21
to fricas...@googlegroups.com
Good catch, please commit.
--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages