This bug happens with FriCAS built with clisp-2.49,
a test failed in tensor.input, "Testcase: MonoidRing".

It should read 'r.first.exp' before the destructive 'reverse! r'.

The behavior of reverse! is different in clisp and sbcl.

https://github.com/oldk1331/fricas/commit/5dfe1d273f31fea51fccbf2c02cbd335ee195789.patch

diff --git a/src/algebra/free.spad b/src/algebra/free.spad
index cb1072b4..39a7847e 100644
--- a/src/algebra/free.spad
+++ b/src/algebra/free.spad
@@ -476,8 +476,9 @@ FreeGroup(S : SetCategory) : Join(Group,
RetractableTo S) with
             empty? r => makeMulti q
             empty? q => makeMulti reverse! r
             r.first.gen = q.first.gen =>
-              setlast!(h := reverse! r,
-                                [q.first.gen, q.first.exp + r.first.exp])
+              -- read 'r.first.exp' before the destructive 'reverse! r'
+              newexp := q.first.exp + r.first.exp
+              setlast!(h := reverse! r, [q.first.gen, newexp])
               makeMulti concat!(h, rest q)
             makeMulti concat!(reverse! r, q)

-- 
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 https://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to