On Fri, Feb 28, 2020 at 12:05:12AM +0100, Ralf Hemmecke wrote: > On 2/27/20 10:41 PM, Kurt Pagani wrote: > > The problem is not the conversion to TeX, but rather a strange way of > storing that in OutputForm. > > (12) -> (eq1 :: OutputForm) pretend SExpression > > (12) (= ((PRIME f ",,,") x) (^ x n)) > > Wouldn't it make more sense to store it as (PRIME f 3) and let the > Formatter deal with how it is shown?
At first glance it looks attractive. But currently higher derivative use Roman numerals. IMO decision between primes, roman numeral and may be arabic is somewhat higher level and should be common to all formatters. To say the truth, calling roman convertion from Boot code is somewhat awkward, so it is simpler to do this at higher level. > Here eq1::OutputForm does too much. > In other words, I would be in favour of moving the code > > add_prime(a : %, s : %) : % == convert [eform 'PRIME, a, s] > prime(a, nn) == (s := new(nn, char ","); add_prime(a, sform s)) > > away from OutputForm and simply say something like > > prime(a, nn) == > if a is of form (PRIME x n) then > (PRIME x n+nn) > else > (PRIME a nn) Hmm, I am not sure what you mean here. AFAICS you propose new behaviour not present in current code. And it looks that you hardcode here associative property of PRIME. This may be not bad, but before writing such code it would be good to say which transformation OutputForm can do and which are not allowed. For example we may have "commutative and associative +" which OutputForm may rearrange and looking the same "literal +" which is considered non-commutative and non-associative. Or maybe do it in different way, say via rigid and flexible trees (OutputForm would be allowed to rearrange flexible tree, but preseve tree structure of rigid ones). -- 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 fricas-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/fricas-devel/20200229142947.GC31425%40math.uni.wroc.pl.