I mentioned that some time ago.  I would like to add indication
of scope to OutputForm.  Main reason is SparseUnivariatePolynomial.
In SparseUnivariatePolynomial variable is effectively anonymous
and for output uses '?'.  This means that in case of nested
SparseUnivariatePolynomial-s it is hard or impossible to decide
which variable is really used.

I think that wrapping polynomial output in new scope construct
will solve the problem, we will be able to decide which variable
is correct one by countion scopes.

To ilustrate, currently we could do:

(7) -> P1 := SUP(INT)                                     

   (7)  SparseUnivariatePolynomial(Integer)
                                                                   Type: Type
(8) -> P2 := SUP(P1)                                      

   (8)  SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
                                                                   Type: Type
(20) -> p1 := monomial(monomial(1, 1)$P1, 0)$P2

   (20)  ?
        Type: SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
(21) -> p2 := monomial(1$P1, 1)$P2             

   (21)  ?
        Type: SparseUnivariatePolynomial(SparseUnivariatePolynomial(Integer))
(22) -> PRETTYPRINT(p1::OutputForm)$Lisp                   
"?"

   (22)  ()
                                                            Type: SExpression
(23) -> PRETTYPRINT(p2::OutputForm)$Lisp
"?"

   (23)  ()
                                                            Type: SExpression

p1 and p2 are different, but OutputForm is identical.  With
scope markers we should get something like

(SCOPE (SCOPE "?"))

for p1 and

(SCOPE "?")

for p2.  To make this useful we also need to change output.
One possibility is to have list of variables to substitute for
"?".  Assuming that the list is ['%a, '%b] we could transform
the first case to "%a" and the second case to "%b".

Drawback is that all users of OutputForm should be updated.
This could be simplifed by doing transformation above in
precondition (which IIUC is used by all our formatters).

Comments?  Aternative ideas?

-- 
                              Waldek Hebisch

-- 
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/20220630212956.GA24450%40fricas.math.uni.wroc.pl.

Reply via email to