Please review this patch:

https://github.com/oldk1331/fricas/commit/6d229ebee9fcf3010d2a045450e96daa29315714.patch

All tests passed:
https://travis-ci.org/oldk1331/fricas/builds/387286568

-- 
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.
From 6d229ebee9fcf3010d2a045450e96daa29315714 Mon Sep 17 00:00:00 2001
From: oldk1331 <[email protected]>
Date: Tue, 29 May 2018 04:02:35 +0800
Subject: [PATCH] Misc cleanups

---
 src/algebra/aggcat.spad     |  7 +++----
 src/algebra/aggcat2.spad    | 47 +++++++++++++++++++++------------------------
 src/algebra/bags.spad       |  7 +------
 src/algebra/graph.spad      |  9 ++-------
 src/algebra/logic.spad      |  3 +--
 src/algebra/mfinfact.spad   |  4 ++--
 src/algebra/rule.spad       |  2 +-
 src/algebra/seg.spad        |  2 +-
 src/algebra/transsolve.spad |  2 +-
 src/algebra/tree.spad       |  1 -
 src/input/bugs2018.input    |  1 -
 src/interp/parse.boot       |  2 +-
 src/interp/util.lisp        |  1 -
 13 files changed, 35 insertions(+), 53 deletions(-)

diff --git a/src/algebra/aggcat.spad b/src/algebra/aggcat.spad
index b8047d10..57f4d66c 100644
--- a/src/algebra/aggcat.spad
+++ b/src/algebra/aggcat.spad
@@ -1157,9 +1157,8 @@ BinaryRecursiveAggregate(S : Type) : Category == RecursiveAggregate S with
        concat(leaves left t, leaves right t)
 
    nodes x ==
-       l := empty()$List(%)
-       empty? x => l
-       concat(nodes left x, concat([x], nodes right x))
+       empty? x => empty()
+       concat(nodes left x, concat(x, nodes right x))
 
    children x ==
        empty? x => empty()
@@ -1206,7 +1205,7 @@ BinaryRecursiveAggregate(S : Type) : Category == RecursiveAggregate S with
 
        if S has CoercibleTo OutputForm then
            coerce(t : %) : OutputForm ==
-               empty? t =>  message("[]")$OutputForm
+               empty? t => message("[]")$OutputForm
                v := value(t)::OutputForm
                empty? left t =>
                    empty? right t => v
diff --git a/src/algebra/aggcat2.spad b/src/algebra/aggcat2.spad
index 11df06dd..ed9fd999 100644
--- a/src/algebra/aggcat2.spad
+++ b/src/algebra/aggcat2.spad
@@ -1,7 +1,4 @@
 )abbrev package FLAGG2 FiniteLinearAggregateFunctions2
---% FiniteLinearAggregateFunctions2
-
-++ Author: ???
 ++ Description:
 ++ FiniteLinearAggregateFunctions2 provides functions involving two
 ++ FiniteLinearAggregates where the underlying domains might be
@@ -123,9 +120,6 @@ FiniteLinearAggregateFunctions2(S, A, R, B):
             w
 
 )abbrev package FSAGG2 FiniteSetAggregateFunctions2
-
---% FiniteSetAggregateFunctions2
-
 ++ Author: Robert S. Sutor
 ++ Date Created: 15 May 1990
 ++ Description:
@@ -141,25 +135,28 @@ FiniteSetAggregateFunctions2(S, A, R, B) : Exports == Implementation where
    B   : FiniteSetAggregate R
 
    Exports ==> with
-     map    : (S -> R, A) -> B          ++ map(f, a) applies function f to each member of
-                                        ++ aggregate \spad{a}, creating a new aggregate with
-                                        ++ a possibly different underlying domain.
-
-     reduce : ((S, R) -> R, A, R) -> R  ++ reduce(f, a, r) applies function f to each
-                                        ++ successive element of the aggregate \spad{a} and an
-                                        ++ accumulant initialised to r.
-                                        ++ For example,
-                                        ++ \spad{reduce(_+$Integer, [1, 2, 3], 0)}
-                                        ++ does a \spad{3+(2+(1+0))}.
-                                        ++ Note: third argument r may be regarded
-                                        ++ as an identity element for the function.
-
-     scan   : ((S, R) -> R, A, R) -> B  ++ scan(f, a, r) successively applies \spad{reduce(f, x, r)}
-                                        ++ to more and more leading sub-aggregates x of
-                                        ++ aggregate \spad{a}.
-                                        ++ More precisely, if \spad{a} is \spad{[a1, a2, ...]}, then
-                                        ++ \spad{scan(f, a, r)} returns
-                                        ++ \spad {[reduce(f, [a1], r), reduce(f, [a1, a2], r), ...]}.
+     map : (S -> R, A) -> B
+         ++ map(f, a) applies function f to each member of
+         ++ aggregate \spad{a}, creating a new aggregate with
+         ++ a possibly different underlying domain.
+
+     reduce : ((S, R) -> R, A, R) -> R
+         ++ reduce(f, a, r) applies function f to each
+         ++ successive element of the aggregate \spad{a} and an
+         ++ accumulant initialised to r.
+         ++ For example,
+         ++ \spad{reduce(_+$Integer, [1, 2, 3], 0)}
+         ++ does a \spad{3+(2+(1+0))}.
+         ++ Note: third argument r may be regarded
+         ++ as an identity element for the function.
+
+     scan : ((S, R) -> R, A, R) -> B
+         ++ scan(f, a, r) successively applies \spad{reduce(f, x, r)}
+         ++ to more and more leading sub-aggregates x of
+         ++ aggregate \spad{a}.
+         ++ More precisely, if \spad{a} is \spad{[a1, a2, ...]}, then
+         ++ \spad{scan(f, a, r)} returns
+         ++ \spad {[reduce(f, [a1], r), reduce(f, [a1, a2], r), ...]}.
 
    Implementation ==> add
      map(fn, a) ==
diff --git a/src/algebra/bags.spad b/src/algebra/bags.spad
index 0cff2ad6..4c272f15 100644
--- a/src/algebra/bags.spad
+++ b/src/algebra/bags.spad
@@ -11,7 +11,6 @@
 ++ Description:
 
 ++ Linked List implementation of a Stack
---% Dequeue and Heap data types
 
 Stack(S : Type) : StackAggregate S with
     stack : List S -> %
@@ -60,7 +59,6 @@ Stack(S : Type) : StackAggregate S with
 ++ Description:
 
 ++ A stack represented as a flexible array.
---% Dequeue and Heap data types
 
 ArrayStack(S : Type) : StackAggregate(S) with
     arrayStack : List S -> %
@@ -117,7 +115,6 @@ ArrayStack(S : Type) : StackAggregate(S) with
 ++ Description:
 
 ++ Linked List implementation of a Queue
---% Dequeue and Heap data types
 
 Queue(S : Type) : QueueAggregate S with
     queue : List S -> %
@@ -157,7 +154,6 @@ Queue(S : Type) : QueueAggregate S with
 ++ Description:
 
 ++ Linked list implementation of a Dequeue
---% Dequeue and Heap data types
 
 Dequeue(S : Type) : DequeueAggregate S with
      dequeue : List S -> %
@@ -209,7 +205,6 @@ Dequeue(S : Type) : DequeueAggregate S with
 
 ++ Heap implemented in a flexible array to allow for insertions
 ++ Complexity: O(log n) insertion, extraction and O(n) construction
---% Dequeue and Heap data types
 
 Heap(S : OrderedSet) : Exports == Implementation where
   Exports == PriorityQueueAggregate S with
@@ -242,7 +237,7 @@ Heap(S : OrderedSet) : Exports == Implementation where
     insert!(x, r) ==
        -- Williams' insertion algorithm O(log n)
        j := (#r) :: Integer
-       r := concat!(r, concat(x, empty()$Rep))
+       r := concat!(r, x)
        while j > 0 repeat
           i := (j-1) quo 2
           if r(i) >= x then break
diff --git a/src/algebra/graph.spad b/src/algebra/graph.spad
index 81ecba54..825fca7d 100644
--- a/src/algebra/graph.spad
+++ b/src/algebra/graph.spad
@@ -1062,8 +1062,7 @@ Loop() : Exports == Implementation where
       construct(concat(l1, reverse l2))$Rep
 
     -- entries(lp) returns list of indexes that make this loop
-    entries(lp : %) : List NNI ==
-      entries(lp pretend PrimitiveArray(NNI))$PrimitiveArray(NNI)
+    entries(lp : %) : List NNI == entries(lp)$Rep
 
     -- start of SetCategory definitions --
 
@@ -1086,9 +1085,6 @@ Loop() : Exports == Implementation where
         if x.(i-1) ~= y.(i-1) then return false
       true
 
-    -- returns true if x is not equal to y
-    _~_=(x : %, y : %) : Boolean == not(x = y)
-
     -- output
     coerce(lp : %) : OutputForm ==
       res : OutputForm := empty()$OutputForm
@@ -1096,8 +1092,7 @@ Loop() : Exports == Implementation where
         x : NNI := lp.(i-1)
         res := hconcat([res,outputForm("->"::Symbol),_
                        x::OutputForm])$OutputForm
-      hconcat([outputForm("["::Symbol),res,_
-             outputForm("]"::Symbol)])$OutputForm
+      bracket(res)
 
 )if false
 
diff --git a/src/algebra/logic.spad b/src/algebra/logic.spad
index dd4e694b..99483fc7 100644
--- a/src/algebra/logic.spad
+++ b/src/algebra/logic.spad
@@ -384,8 +384,7 @@ IncidenceAlgebra(R : Ring, S : SetCategory): Decl == Impl where
           [newA, newindices]
 
       coerce(A) : OutputForm ==
-          bracket commaSeparate [(matrix A)::OutputForm,
-                                 (indices A)::OutputForm]
+          bracket [(matrix A)::OutputForm, (indices A)::OutputForm]
 
       _=(A1 : %, A2 : %) : Boolean ==
           (indices A1 = indices A2) and (matrix A1 = matrix A2)
diff --git a/src/algebra/mfinfact.spad b/src/algebra/mfinfact.spad
index bddb8cbc..94d4cab1 100644
--- a/src/algebra/mfinfact.spad
+++ b/src/algebra/mfinfact.spad
@@ -129,7 +129,7 @@ MultFiniteFactorize(OV, E, F, PG) : C == T where
              lf := mfconst(ffactor, dx, lvar, ldeg)
           else lf := mfpol(ffactor, var, dx, lvar, ldeg)
           auxfl := [[lfp, ffexp]$SUParFact  for lfp in lf]
-          factorlist := append(factorlist, auxfl)
+          factorlist := concat!(auxfl, factorlist)
         lcfacs := */[leadingCoefficient leadingCoefficient(f.irr)^(f.pow)
                              for f in factorlist]
         [(leadingCoefficient leadingCoefficient(um) exquo lcfacs)::R,
@@ -333,7 +333,7 @@ MultFiniteFactorize(OV, E, F, PG) : C == T where
 
               ---  Choose the variable of least degree  ---
     varChoose(m : P, lvar : L OV, ldeg : L NNI) : NewOrd ==
-      k := "min"/[d for d in ldeg]
+      k := "min"/ldeg
       k = degree(m, first lvar) =>
                              [univariate(m, first lvar), lvar, ldeg]$NewOrd
       i := position(k, ldeg)
diff --git a/src/algebra/rule.spad b/src/algebra/rule.spad
index 6bd3f544..d481038a 100644
--- a/src/algebra/rule.spad
+++ b/src/algebra/rule.spad
@@ -124,7 +124,7 @@ RewriteRule(Base, R, F) : Exports == Implementation where
       [0, 1]
 
     coerce(x : %) : OutputForm ==
-      infix(" == "::Symbol::OutputForm,
+      infix(message " == ",
             lhs(x)::OutputForm, rhs(x)::OutputForm)
 
 )abbrev package APPRULE ApplyRules
diff --git a/src/algebra/seg.spad b/src/algebra/seg.spad
index 345dabda..64a61aa2 100644
--- a/src/algebra/seg.spad
+++ b/src/algebra/seg.spad
@@ -73,7 +73,7 @@ SegmentExpansionCategory(S : OrderedRing, L : StreamAggregate(S)) : Category ==
         ++ For example, \spad{expand(1..5 by 2) = [1, 3, 5]}.
       map : (S -> S, %) -> L
         ++ map(f, l..h by k) produces a value of type L by applying f
-        ++ to each of the succesive elements of the segment, that is,
+        ++ to each of the successive elements of the segment, that is,
         ++ \spad{[f(l), f(l+k), ..., f(lN)]}, where \spad{lN <= h < lN+k}.
 
 )abbrev domain SEG Segment
diff --git a/src/algebra/transsolve.spad b/src/algebra/transsolve.spad
index ccb83de7..00e6b491 100644
--- a/src/algebra/transsolve.spad
+++ b/src/algebra/transsolve.spad
@@ -617,7 +617,7 @@ TransSolvePackageService(R) : Exports == Implementation where
    V   ==> Variable
    L   ==> List
    SUP ==> SparseUnivariatePolynomial
-   ACF      ==> AlgebraicallyClosedField()
+   ACF ==> AlgebraicallyClosedField()
 
 
    Exports == with
diff --git a/src/algebra/tree.spad b/src/algebra/tree.spad
index 22456997..08ec1a4b 100644
--- a/src/algebra/tree.spad
+++ b/src/algebra/tree.spad
@@ -378,7 +378,6 @@ BinaryTree(S : SetCategory) : Exports == Implementation where
        ++ value v and left subtree l and right subtree r.
   Implementation == add
      Rep := List Tree S
-     import from List Tree S
 
      t1 = t2 == (t1::Rep) =$Rep (t2::Rep)
      empty()== ([] ::Rep):: %
diff --git a/src/input/bugs2018.input b/src/input/bugs2018.input
index c7b7d194..edf62d3d 100644
--- a/src/input/bugs2018.input
+++ b/src/input/bugs2018.input
@@ -84,7 +84,6 @@ testEquals("fl.first.factor", "4")
 
 testcase "'remove' with _"failed_""
 
-li := [2,4,3,2,5,2,7,2,2,7]
 li10 := [recip(i::IntegerMod 10) for i in 0..9]
 lir := [1, 7, 3, 9]
 f : Union(IntegerMod(10),"failed") := "failed"
diff --git a/src/interp/parse.boot b/src/interp/parse.boot
index ebcebf95..19994b9b 100644
--- a/src/interp/parse.boot
+++ b/src/interp/parse.boot
@@ -192,7 +192,7 @@ parseIf t ==
   ifTran(parseTran p,parseTran a,parseTran b) where
     ifTran(p,a,b) ==
       p = 'true  => a
-      p = 'false  => b
+      p = 'false => b
       p is ['not,p'] => ifTran(p',b,a)
       p is ['IF,p',a',b'] => ifTran(p',ifTran(a',COPY a,COPY b),ifTran(b',a,b))
       p is ['SEQ,:l,['exit,1,p']] =>
diff --git a/src/interp/util.lisp b/src/interp/util.lisp
index 218ce41a..637fe301 100644
--- a/src/interp/util.lisp
+++ b/src/interp/util.lisp
@@ -148,7 +148,6 @@ loads the databases, sets up autoload triggers and clears out hash tables.
 After this function is called the image is clean and can be saved.
 |#
 (defun build-interpsys (load-files spad)
-  (declare (ignore nagbr-files))
   #-:ecl
   (progn
       (mapcar #'load load-files)

Reply via email to