Bill Page wrote: > > On Tue, Sep 2, 2008 at 6:34 PM, Waldek Hebisch wrote: > > > > Some time ago Bill Page proposed a patch to eliminate Fortran > > names from the output of unparse. Unfortunatly, his patch > > caused regression when printing some types. > > > > Yes. See: > > http://axiom-wiki.newsynthesis.org/401UnparseGeneratesFortranFunctionNames > > > In fact, I think that uparsing should work in a quite different > > way: > > 1) we should first walk the expression tree and compute > > priority at each node > > 2) based on 1 we should mark places where we need to insert > > parentheses -- in this step we probably should add various > > symbols as markup, but we should still keep tree in symbolic > > form > > 3) Only in final step we should generate string from the tree, > > just by simple walk which collects translations of separate > > symbols. > > > > In principle steps 1 and 2 are similar for all output formats, > > so we could use generic setup for them (of course values of > > priorities may depend on output format). Ideally, much of > > step 3 could be re-used. > > > > That is (more or less) what the code does now, isn't it? >
Current output code is one-pass and very early converts symbols to strings. This has undesirable effects: 1) When patterm matching tree nodes one has to be carefull to handle both symbols and strings. For more complicated matches one must ignore formatting junk (otherwise match will fail). 2) Extra data is mixed with original tree, so one may err and trat original data as formatting codes (Issue 132) Fortran handling code is smarter than regular output routines, but still has the same problems. Note: whan I write mark I mean that markup is logically out-of-band and can not be mistaken for data (and vice versa). > > However, I think that we have much more urgent tasks > > than re-write of output routines. In particular unparse has > > only little use. > > unparse is critical for the Sage interface. Do you use unparse in the interface? > I tried this patch but something goes wrong. See: > > http://axiom-wiki.newsynthesis.org/401UnparseGeneratesFortranFunctionNames#bottom > > Waldek, did you try this example? > > y := cos(x2) + 2*x1 > unparse(y::INFORM) > > Does it work for you? > Works for me (in sbcl based FriCAS). There is something strange with setup you use for MathAction: examples from Issue 83 work fine for me, but you report failure. -- Waldek Hebisch [EMAIL PROTECTED] --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "FriCAS - computer algebra system" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/fricas-devel?hl=en -~----------~----~----~----~------~----~------~--~---
