On Sat, Jun 22, 2024 at 06:03:51PM +0200, Ralf Hemmecke wrote:
> According to
> 
> https://github.com/fricas/fricas/blob/master/src/algebra/variable.spad#L58
> 
> the argument f is a symbol. I think that the output function is not perfect.
> 
>   coerce(r : %) : OutputForm == outputMapTran(f, r)$Lisp
> 
> It leads to
> 
> %%% (409) -> function(sin(x*y), 'g, 'x, 'y)
> 
> %%% (411) -> function(sin x, 'f, 'x)
> 
> (411)  f
>                                           Type: Symbol
> %%% (412) -> f
> 
> (412)  f x == sin(x)
>                                Type: FunctionCalled(f)
> 
> %(409)  g
>                                           Type: Symbol
> %%% (410) -> g
> 
> (410)  g (x, y) == sin(x y)
>                                Type: FunctionCalled(g)
> 
> What is OK for one argument (without parentheses), is not OK for two
> arguments. There is a space between g and the open (. Of course, since the
> OutputForm is wrong neither i-output.boo not the TeXFormat get it right. TeX
> output looks like
> 
> g \  {\left( x, \: y \right)}\  == \  {\cos \left({{y+x}} \right)}
> 
> But there are also cases like this:
> 
> %%% (468) -> )clear prop g
> %%% (468) -> g(n|n>1 and odd? n, t | t > 9) == tanh n + t
> %%% (469) -> g
> 
>    (469)  g ((n, t) | n > 1 and odd?(n) and t > 9) == tanh(n) + t
>                                 Type: FunctionCalled(g)
> 
> whose corresponding OutputForm is this:
> (CONCATB  g
>  (PAREN (| (PAREN (AGGLST n t)) (and (and (> n 1) (odd? n)) (> t 9))))
>   ==  (+ (tanh n) t))
> 
> I guess, the definition of outputMapTran would have to be changed to really
> produce just (f x) or (g x y) for the function application side (left-hand
> side) in case that there is no conditional part.
> 
> I leave that to someone else.

I think that we should put parentheses also around a single argument.
Then we can concat function name and arguments without space.

The result are like:

   (16)  foo(u) == exp(u)

   (2)  g((n, t) | n > 1 and odd?(n) and t > 9) == tanh(n) + t

   (4)  h(x, y) == sin(x y)

I think that is better than previous results containing space.

-- 
                              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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZoSt4nzPdj03oO6P%40fricas.org.

Reply via email to