%mathpiper,title=""
ring := Ring("Z(a,b,x,y) L"); 

gens := JavaCall(ring,"gens");

%/mathpiper

    %output,preserve="false"
      Result: {edu.jas.poly.GenPolynomial,edu.jas.poly.GenPolynomial,edu.jas.poly.GenPolynomial,edu.jas.poly.GenPolynomial,edu.jas.poly.GenPolynomial}
.   %/output



%mathpiper,title=""

ForEach(variable,gens)
[

    variableName := JavaToValue(JavaCall(variable,"toString"));
    
    Echo(variableName);
    
    If(Not IsNumber(variableName), MacroBind(variableName,MetaSet(variableName,"jas",variable)) );
    
];

f := 5*a*x + 5*b*x - 2*b*y - 2*a*y;

g := a-2;

%/mathpiper

    %output,preserve="false"
      Result: a-2
      
      Side Effects:
      1 
      a 
      b 
      x 
      y 
      
.   %/output






%mathpiper,title=""

IsJas(atom) :=
[
    If(MetaGet(atom,"jas") != Empty, True, False);

];

%/mathpiper

    %output,preserve="false"
      Result: True
.   %/output






%mathpiper,title=""

200 # a_IsInteger * b_IsJas <-- Echo("H");

201 # _a * b_IsJas <-- Echo("I");

%/mathpiper

    %output,preserve="false"
      Result: True
.   %/output





%mathpiper,title=""

x := (xx/yy)/zz;

x:=(
  x/::Hold({
      (_a/_b)/_c <- (a)/(b*c),
      (-(_a/_b))/_c <- (-a)/(b*c),
      (_a/_b)*_c <- (a*c)/b,
      (_a*_b)^_m <- a^m*b^m,
      (_a/_b)^_m*_c <- (a^m*c)/b^m,
      _a*(_b+_c) <- a*b+a*c,
      (_b+_c)*_a <- a*b+a*c,
      (_b+_c)/_a <- b/a+c/a,
      _a*(_b-_c) <- a*b-a*c,
      (_b-_c)*_a <- a*b-a*c,
      (_b-_c)/_a <- b/a-c/a
 }));

%/mathpiper

    %output,preserve="false"
      Result: xx/(yy*zz)
.   %/output






%mathpiper,title=""

5*a*x;

%/mathpiper

    %output,preserve="false"
      Result: True
      
      Side Effects:
      H
      I
      
.   %/output


