Re: [fricas-devel] factorial to OutputForm

2024-05-18 Thread Ralf Hemmecke

This is regular '%display' property, set in BasicOperator.


Ah. Cool.
And just for reference...

The property is defined in op.spad like this.

dfact x  == postfix("!"::Symbol::O, (ATOM(x)$Lisp => x; paren x))

The following code will then print "factorial(n)" as factorial(n).


  newdfact(x:OF):OF == prefix("factorial"::Symbol,[x])
  fa := factorial(n)
  k := kernels(fa).1
  op := operator k -- this is the factorial BasicOperator
  display(op, newdfact)

'display' will set '%display' property to value that you give. But 
this value will affect translation to OutputForm, so all formatters.


Yes. But if one wants to achieve something locally, other parts maybe 
uninteresting.


Thank you for your help.

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 view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/163066e6-beba-4562-a72e-9faa5afbaadf%40hemmecke.org.


Re: [fricas-devel] factorial to OutputForm

2024-05-18 Thread Waldek Hebisch
On Sat, May 18, 2024 at 09:21:27PM +0200, Ralf Hemmecke wrote:
> H, am somehow unable to find where the transformation to the SExpression
> below happens. Does that have to do with '%specialDisp?
> But even then I could not find a special treatment for 'factorial.

This is regular '%display' property, set in BasicOperator.

> Background of this question.
> I actually wanted to tweak Format1D locally so that it prints
> factorial(a) instead of a!. But obviously ยด'factorial is not a known
> operator for OutputForm, so it is basically impossible to output factorial
> differently.

'display' will set '%display' property to value that you give.
But this value will affect translation to OutputForm, so all
formatters.

-- 
  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/ZkkQjJx-6Cb1ajoe%40fricas.org.