Some Context Probleme ?



Hello,
your code (with small corrections) works fine for me
(C13)                          PARTSWITCH : TRUE
(D13)                                TRUE
(C14) PART2SUM(x) := BLOCK([rep : 0, i],

           FOR i FROM 2 UNLESS PART(x, i) = END DO rep : PART(x, i) + rep, 
rep)
(D14) PART2SUM(x) := BLOCK([rep : 0, i],

           FOR i FROM 2 UNLESS PART(x, i) = END DO rep : PART(x, i) + rep, 
rep)
(C15)                            Fonc : [f, g]
(D15)                               [f, g]
(C16)       TESTFONC(x) := IF MEMBER(x, Fonc) THEN TRUE ELSE FALSE
(D16)       TESTFONC(x) := IF MEMBER(x, Fonc) THEN TRUE ELSE FALSE
(C17) TESTSUM(x) := IF ATOM(x) THEN FALSE

                                ELSE (IF PART(x, 0) = "+" THEN TRUE ELSE 
FALSE)
(D17) TESTSUM(x) := IF ATOM(x) THEN FALSE

                                ELSE (IF PART(x, 0) = "+" THEN TRUE ELSE 
FALSE)
(C18)                      MATCHDECLARE(f, TESTFONC)
(D18)                                DONE
(C19)                        MATCHDECLARE(A, TRUE)
(D19)                                DONE
(C20)                      MATCHDECLARE(B, TESTSUM)
(D20)                                DONE
(C21)     DEFRULE(LIN, f(A, B), f(A, PART2SUM(B)) + f(A, PART(B, 1)))
(D21)        LIN : f(A, B) -> f(A, PART(B, 1)) + f(A, PART2SUM(B))
(D22)                               pb1.mac
(C22) apply1(f(x,y),lin);
(D22)                               f(x, y)
(C23) apply1(f(x,y+r+t),lin);
(D23)                     f(x, y) + f(x, t) + f(x, r)
(C24) applyb1(f(x,y+r+t),lin);
(D24)                        f(x, y) + f(x, t + r)
(C25) applyb1(rf(x,y+r+t),lin);
(D25)                          rf(x, y + t + r)
(C26) applyb1(g(x,y+r+t),lin);
(D26)                        g(x, y) + g(x, t + r)
(C27) rf(x,y):=f(x,y);
(D27)                         rf(x, y) := f(x, y)
(C28) applyb1(rf(x,y+r+t),lin);
(D28)                        f(x, y) + f(x, t + r)


There is a strange error however if I evaluate apply rules (apply1 or applyb1) 
in batch mode (say, if I include, applyb1(rf(x,y+r+t),lin) in batch file). In 
this case I have  
C11)                    APPLY1(f(x, t + r + y), LIN)

*** - GET: 6 is not a symbol
The following restarts are available:
R1 = Macsyma top-level

1. Break [1]>
Is this a bug? That was under clisp. Cmucl gives more information
C11)                    APPLY1(f(x, t + r + y), LIN)

Type-error in KERNEL::OBJECT-NOT-SYMBOL-ERROR-HANDLER:  6 is not of type 
SYMBOL

Restarts:
  0: [MACSYMA-QUIT] Macsyma top-level
  1: [ABORT       ] Skip remaining initializations.

Debug  (type H for help)

("DEFUN GET" 6 LISP-NO-SIMP)[:OPTIONAL]
Source: Error finding source:
Error in function DEBUG::GET-FILE-TOP-LEVEL-FORM:  Source file no longer 
exists:
  target:code/symbol.lisp.




On Tuesday 10 December 2002 16:40, Marc GILG wrote:
> Hello,
>
> Thank you for your answer.
> I'm using maxima on Linux.
>
> I try what you say ,
> and I get :
> for APPLYB1(f[x,y],LIN) I get the fonction calls.
> For APPLYB1(a,LIN) where a:e(x,y); I get :
> Error: Caught fatal error [memory may be damaged]
> Fast links are on: do (si::use-fast-links nil) for debugging
> Error signalled by COND.
> Broken at IS.  Type :H for Help.
> MAXIMA>>
>
> How can I disable Fast links ?
> si::use-fast-links nil make an error.
>
> Thank you for your help,
>
> Marc
>
> Le lun 09/12/2002 à 16:57, Richard Fateman a écrit :
> > Your program works in commercial macsyma on windows.
> >
> >
> > You could read about  declare(f,linear) to see if that
> > can help.
> > Also you can do this:
> > testfonc(x):=is (member(x,Fonc));
> >
> > and  testsum(x):= is ( not(atom(x)) or (part(x,0)="+"))
> >
> >    what did you want to do if the expression is 3*z ??
> > If you set
> > debugmode:true
> >
> > and trace(is)
> >
> > you might get more information.
> > RJF
> >
> > Marc GILG wrote:
> > > Hello,,
> > >
> > > I have create a file with some rules definitions, for exemple :
> > > LIN : f[x+y,z]->f[x,z]+f[y,z]
> > > A have also define a fonction in this file :
> > > e(x,y):=f[x,y];
> > > Now a load the file with BATCHLOAD("pb.mac");
> > > Now if I do APPLYB1(f[x,y],LIN); then OK
> > > If I do APPLYB1(e(x,y),LIN); then mistake !!!
> > >
> > > What happed ?
> > >
> > > Thank you for your help.
> > >
> > > Marc GILG
> > > PS: I joint a copy of the file and the output from xmaxima.
> > >
> > >
> > >
> > >
> > > -----------------------------------------------------------------------
> > >-
> > >
> > >
> > > PARTSWITCH:TRUE$
> > >
> > > PART2SUM(x):=BLOCK([rep:0,i],FOR i:2 STEP 1 UNLESS PART(x,i)=END DO
> > >                       rep:rep+PART(x,i),rep)$
> > >
> > > /* Definition des noms de fonction */
> > > Fonc : [f,g]$
> > > /* Test si x est une fonction */
> > > TESTFONC(x):=IF MEMBER(x,Fonc) THEN TRUE ELSE FALSE$
> > >
> > > /* Teste si x est une somme */
> > >  TESTSUM(x):=IF ATOM(x) THEN FALSE ELSE IF PART(x,0)="+" THEN TRUE ELSE
> > > FALSE$
> > >
> > >
> > > /* Declaration de modeles */
> > >  MATCHDECLARE(f,TESTFONC)$
> > >  MATCHDECLARE(A,TRUE)$
> > >
> > > /* Declaration de la regle LIN */
> > >  MATCHDECLARE(B,TESTSUM)$
> > >  DEFRULE(LIN,f[A,B],f[A,PART(B,1)]+f[A,PART2SUM(B)])$
> > >
> > > e(x,y):=f[x,y];
> > >
> > >
> > > -----------------------------------------------------------------------
> > >-
> > >
> > > (C1)
> > >
> > > batching #p/home/gilg/maxima/pb.mac
> > > (C2) 						 PARTSWITCH : TRUE
> > > (C3)  PART2SUM(x) := BLOCK([rep : 0, i], FOR i FROM 2 UNLESS PART(x, i)
> > > = END DO rep : PART(x, i) + rep, rep) (C4) 						   Fonc : [f, g]
> > > (C5) 			      TESTFONC(x) := IF MEMBER(x, Fonc) THEN TRUE ELSE FALSE
> > > (C6) 	        TESTSUM(x) := IF ATOM(x) THEN FALSE ELSE (IF PART(x, 0) =
> > > "+" THEN TRUE ELSE FALSE) (C7) 					     MATCHDECLARE(f, TESTFONC)
> > > (C8) 					       MATCHDECLARE(A, TRUE)
> > > (C9) 					     MATCHDECLARE(B, TESTSUM)
> > > (C10) 			       DEFRULE(LIN, f	 , f		   + f		   )
> > > 					     A, B   A, PART2SUM(B)    A, PART(B, 1)
> > > (C11) 						 e(x, y) := f
> > > 							     x, y
> > > (D11) 						 e(x, y) := f
> > > 							     x, y
> > > (C12) APPLYB1(f[x,y],LIN);
> > > (D12) 						       f
> > > 							x, y
> > > (C13) APPLYB1(e(x,y),LIN);
> > >
> > > Error: Caught fatal error [memory may be damaged]
> > > Fast links are on: do (si::use-fast-links nil) for debugging
> > > Error signalled by COND.
> > > Broken at IS.  Type :H for Help.
> > > MAXIMA>>
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima@www.math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima