[PATCH] add space before derivative in output

12 views
Skip to first unread message

oldk1331

unread,
Apr 13, 2019, 9:07:56 PM4/13/19
to fricas...@googlegroups.com
This patch fix cases like (missing space between 'x' and 'f'):

(1) -> f:=operator 'f; x*D(f x,x)

          ,
   (1)  xf (x)


I have compared src/input/*output before and after this patch,
no unexpected breakage.

diff --git a/ChangeLog b/ChangeLog
index fad1db84..60132358 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-04-09  Qian Yun  <oldk...@gmail.com>
+
+    * src/interp/i-output.boot: add space before derivative
+    in output
+
 2019-02-25  Ralf Hemmecke  <ra...@hemmecke.org>

     * src/algebra/array2.spad: add hashUpdate! to
diff --git a/src/input/i_bugs.input b/src/input/i_bugs.input
index 931c54b2..d577aacd 100644
--- a/src/input/i_bugs.input
+++ b/src/input/i_bugs.input
@@ -291,3 +291,8 @@

 xk(s: String): Integer == integer(parse(s)@InputForm)
 xk("1");
+
+-- space before derivative
+f := operator 'f;
+x*D(f x, x)
+D(f(x, y^2), [x, y])
diff --git a/src/interp/i-output.boot b/src/interp/i-output.boot
index b12533f5..2adeba9b 100644
--- a/src/interp/i-output.boot
+++ b/src/interp/i-output.boot
@@ -490,6 +490,8 @@
   wasSimple =>
     atom cur or keyp cur="SUB" or keyp cur = "OVERBAR" or op="**" or
       op = "^" or (atom op and not NUMBERP op and not GETL(op,"APP"))
+        -- deal with cases like "x*f'(x)"
+        or (keyp op = "PRIME" or keyp op = "SUB")

 isQuotient op ==
   op="/" or op="OVER"

Waldek Hebisch

unread,
Apr 16, 2019, 2:38:13 PM4/16/19
to fricas...@googlegroups.com
oldk1331 wrote:
>
> This patch fix cases like (missing space between 'x' and 'f'):
>
> (1) -> f:=operator 'f; x*D(f x,x)
>
> ,
> (1) xf (x)
>
>
> I have compared src/input/*output before and after this patch,
> no unexpected breakage.

OK, please commit.

--
Waldek Hebisch
Reply all
Reply to author
Forward
0 new messages