Clearly, the usage of using "concat!" to add an element to
the end of a list is extremely inefficient.
--
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 on the web visit
https://groups.google.com/d/msgid/fricas-devel/CAGBJN91TUUrLy52msTZXCAhzB71p5godbow49hwogTyx1xK2RQ%40mail.gmail.com.
diff --git a/src/algebra/mring.spad b/src/algebra/mring.spad
index 4092362c..8d76157e 100644
--- a/src/algebra/mring.spad
+++ b/src/algebra/mring.spad
@@ -273,13 +273,13 @@ MonoidRing(R : Ring, M : Monoid) : MonoidRingCategory(R, M) == MRdefinition wher
ta:Term := first repa; tb:Term := first repb
ra:Rep := rest repa; rb:Rep := rest repb
res :=
- smaller?(tb.Mn, ta.Mn) => (repa := ra; concat!(res, ta))
- smaller?(ta.Mn, tb.Mn) => (repb := rb; concat!(res, tb))
+ smaller?(tb.Mn, ta.Mn) => (repa := ra; concat(ta, res))
+ smaller?(ta.Mn, tb.Mn) => (repb := rb; concat(tb, res))
repa := ra; repb := rb
not zero?(r := ta.Cf + tb.Cf) =>
- concat!(res, [ta.Mn, r])
+ concat([ta.Mn, r], res)
res
- per concat!(res, concat(repa, repb))
+ per concat!(reverse! res, if empty? repa then repb else repa)
coefficient(a, m) ==
for t in a repeat