On 07/05/2014 02:47 AM, Waldek Hebisch wrote:
>> http://fricas.github.io/api/OutputForm.html#index-81
>>
>> (2) -> string("ab"::OutputForm)
>>
>>    (2)  ""ab""
>>                                         Type: OutputForm
> 
> Try:
> (6) -> string("ab" pretend OutputForm)
> 
>    (6)  "ab"
>                                                              Type: OutputForm
> 
> Probably better signature would be:
> 
>   string : String -> %
> 
> BTW: AFAICS current version is unused, so doing change is
> reasonable.

Well... yes, maybe it would be reasonable, but it can be delayed.

The I've dealt with a number of OutputForm's in the last days and
although, the idea of a middle layer between the algebra and an actual
visual output is not so bad, OutputForm is not abstract enough. In fact,
it's nowhere defined of what it can do and what it shouldn't do to an
expression.

For example, we have left/right/center.

https://github.com/fricas/fricas/blob/master/src/algebra/outform.spad#L231

That's clearly describing the visual appearance, i.e. it's style
information, whereas sum, bracket, root, look more like an abstract
description of the structure of the expression.
Well, for left/right/center, the functions are perhaps OK, but their
implementation is not. Instead of

  center(a, w)   == hconcat(hspace((w - width(a)) quo 2), a)

we should rather have just

  center(a) == convert [eform 'CENTER, a]

In view of my new extensible TexFormat, I think, it would be better to
let OutputForm only deal with building an abstract tree and let the
formatters deside what to do with this tree. Dealing with a new operator
in OutputForm, can be adjusted at runtime in the formatter (e.g.
TexFormat) code.

Furthermore, I think it was in outtrans from i-output.boot that I saw a
transformation of the algebaic expression in an OutputForm. Something
like  (+ (a (- b)) would be changed to (- a b) or (* a (- b)) into
(- (* a b)).
It looks reasonable, but in my eyes, that should not be the task of
anything in OutputForm.

OK, that's perhaps quite a big project, but that is where we should be
aiming at. And... of course, using OutputForm only for things that have
been created by Algeba and not by anything below.

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 [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/fricas-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to