axiom-developer
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] 20071218.01.acr.patch


From: daly
Subject: [Axiom-developer] 20071218.01.acr.patch
Date: Wed, 19 Dec 2007 16:22:37 -0600

Date: Wed, 19 Dec 2007 10:20:49 -0800
From: Arthur Ralfs <address@hidden>
Subject: Re: [Axiom-developer] axserver patch for lastType


> > This patch is for axserver.spad.pamphlet to fix the lastType 
> function which
> > wasn't doing the right thing.
> 
> Could you give me an example of the wrong thing / right thing so 
> I can
> see that the patch was applied correctly?
> 
> Tim

Just about any sequence of commands will start off right but then
go wrong.  For example the recent derivative example:

x:=operator x         Type: BasicOperator
y:=operator y         Type: BasicOperator
F:=operator F         Type: BasicOperator
a:=F(x z,y z,z**2)+x y(z+1)         Type: BasicOperator   
                          should be Expression( Integer )

even simpler, issue )clear all then

x         Type: Variable x
x(1)  this is an error but still gives Type: Variable x,  with patch it
gives no type.

Arthur

=======================================================================
diff --git a/changelog b/changelog
index ca336c0..001a035 100644
--- a/changelog
+++ b/changelog
@@ -1,3 +1,4 @@
+20071218 acr src/algebra/axserver.spad fix lastType output re: errors
 20071217 tpd src/algebra/variable.spad ignore regression test gensym (7041)
 20071217 tpd src/algebra/lodo.spad ignore regression test gensym (7042)
 20071217 acr src/algebra/mathml.spad fix hex(10) mathml rendering (7015)
diff --git a/src/algebra/axserver.spad.pamphlet 
b/src/algebra/axserver.spad.pamphlet
index 77910f1..6862900 100644
--- a/src/algebra/axserver.spad.pamphlet
+++ b/src/algebra/axserver.spad.pamphlet
@@ -518,18 +518,57 @@ This is done in the call to replace-entitites (see 
http.lisp)
        CLOSE(q)$Lisp
        CLOSE(s)$Lisp
 
+@
+\subsection{lastType}
+To examine the \$internalHistoryTable use the following line
+\begin{verbatim}
+  )lisp |$internalHistoryTable|
+\end{verbatim}
+We need to pick out first member of internalHistoryTable and then pick out
+the element with \% as first element. Here is an example showing just
+the first element of the list, which correponds to the last command.
+
+Note that the last command does not necessarily correspond to the last
+element of the first element of \$internalHistoryTable as it is in this
+example.
+\begin{verbatim}
+   (
+    (4 NIL
+    (x (value (BasicOperator) WRAPPED . #<vector 09a93bd0>))
+    (y (value (BasicOperator) WRAPPED . #<vector 09a93bb4>))
+    (% (value (Matrix (Polynomial (Integer))) WRAPPED . #<vector 0982e0e0>))
+    )
+   ...
+   )
+\end{verbatim}
 
+We also need to check for input error in which case the \$internalHistoryTable
+is not changed and the type retrieved would be that for the last correct
+input.
+<<package AXSERV AxiomServer>>=
    lastType():String ==
---  The last history entry is the first item in the $internalHistoryTable 
---  list so car(_$internalHistoryTable$Lisp) selects it.  Here's an example:
---  (3 (x+y)**3 (% (value (Polynomial (Integer)) 
---  WRAPPED 1 y (3 0 . 1) (2 1 x (1 0 . 3)) (1 1 x (2 0 . 3))
---  (0 1 x (3 0 . 1)))))
---  This corresponds to the input "(x+y)**3" being issued as the third 
---  command after starting axiom.  
--- The following line selects the type information.
-       string car(cdr(car(cdr(car(cdr(cdr(car(_$internalHistoryTable$Lisp)_
-         $Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp)$Lisp
+     SETQ(first$Lisp,FIRST(_$internalHistoryTable$Lisp)$Lisp)$Lisp
+     count:Integer := 0
+     hisLength:Integer := LIST_-LENGTH(_$internalHistoryTable$Lisp)$Lisp
+     length:Integer := LIST_-LENGTH(first$Lisp)$Lisp
+     -- This initializes stepSav.  The test is a bit of a hack, maybe I'll
+     -- figure out the right way to do it later.
+     if string stepSav$Lisp = "#<OBJNULL>" then SETQ(stepSav$Lisp, 0$Lisp)$Lisp
+     -- If hisLength = 0 then the history table has been reset to NIL
+     -- and we're starting numbering over
+     if hisLength = 0 then SETQ(stepSav$Lisp, 0$Lisp)$Lisp
+     if hisLength > 0 and 
+       car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp ^= stepSav$Lisp then
+        SETQ(stepSav$Lisp,car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp)$Lisp
+        while count < length  repeat
+         position(char "%",string FIRST(first$Lisp)$Lisp) = 2 => 
+           count := length+1
+         count := count +1
+         SETQ(first$Lisp,REST(first$Lisp)$Lisp)$Lisp
+     count = length + 1 => 
+         string SECOND(SECOND(FIRST(first$Lisp)$Lisp)$Lisp)$Lisp
+     ""
+
 
    lastStep():String ==
        string car(car(_$internalHistoryTable$Lisp)$Lisp)$Lisp




reply via email to

[Prev in Thread] Current Thread [Next in Thread]