On 05/26/2016 02:44 PM, Waldek Hebisch wrote:
> oldk1331 wrote:
>>
>>> I'm not sure if this patch creates unnecessary parenthesis elsewhere.
>>
>> One change I noticed is "unparse(( t-1 )::INFORM)", it used to be
>> "t+-1", after patch it's "t+(-1)", is it a bug that it doesn't return "t-1"?
> 
> That is a tricky question.  InputForm (and OutputForm) are supposed
> to work for all domains.  In abelian semigroup containing symbols
> and integers 't + -1' makes sense, but 't-1' is undefined:
> we can add integer '-1' to symbol 't', but there is no way to
> subtract.  In principle all nontrivial transformations should be
> done in domains (where we have axioms like associativity, etc.).

I still don't see why 't + -1' makes sense. I would always want this as
"t+(-1)". To turn that properly back into "t-1" is impossible without
information about types. Interestingly what the tex output formatter
does is to simply replace "+-" by "-". See

https://github.com/fricas/fricas/blob/master/src/algebra/tex.spad#L224

That looks more like a hack.

I don't know whether it makes sense to have "-" as an operator in
InputForm/OutputForm so that we would get

  (- t 1)

as a result of ( t-1 )::INFORM.

The specification of InputForm is rather vague.

++   Domain of parsed forms which can be passed to the interpreter.
++   This is also the interface between algebra code and facilities
++   in the interpreter.

Ralf

-- 
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 fricas-devel+unsubscr...@googlegroups.com.
To post to this group, send email to fricas-devel@googlegroups.com.
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