I have a few patches for aggcat.spad, but one category at a time. First, child? only uses '=', so BasicType is enough. child? in RecursiveAggregate requires BasicType.
Second, '=' are defined for the finite case, so a requirement of 'if % has finiteAggregate and S has BasicType' is reasonable. While the previous SetAggregate is unreasonable: no function from SetAggregate is used. Third, coerce to OutputForm requires CoercibleTo OutputForm, not SetCategory, see all the other implementations of coerce in aggcat.spad. https://github.com/oldk1331/fricas/commit/2329b5f72c3f345a6254bce73826a46a224e20f8.patch diff --git a/src/algebra/aggcat.spad b/src/algebra/aggcat.spad index b4b74cc..f011412 100644 --- a/src/algebra/aggcat.spad +++ b/src/algebra/aggcat.spad @@ -1086,7 +1086,7 @@ ++ nodes of tree \spad{t} in left-to-right order. distance : (%, %) -> Integer ++ distance(u, v) returns the path length (an integer) from node u to v. - if S has SetCategory then + if S has BasicType then child? : (%, %) -> Boolean ++ child?(u, v) tests if node u is a child of node v. node? : (%, %) -> Boolean @@ -1176,12 +1176,12 @@ empty? right x => [left x] [left x, right x] - if % has SetAggregate(S) and S has SetCategory then + if % has finiteAggregate and S has BasicType then node?(u, v) == empty? v => false u = v => true - for y in children v repeat node?(u, y) => return true + node?(u, left v) or node?(u, right v) => return true false x = y == @@ -1189,13 +1189,12 @@ empty?(y) => false value x = value y and left x = left y and right x = right y - if % has finiteAggregate then - member?(x, u) == - empty? u => false - x = value u => true - member?(x, left u) or member?(x, right u) + member?(x, u) == + empty? u => false + x = value u => true + member?(x, left u) or member?(x, right u) - if S has SetCategory then + if S has CoercibleTo OutputForm then coerce(t : %) : OutputForm == empty? t => "[]"::OutputForm v := value(t):: OutputForm -- 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.
