dipvars.red 591 B

1234567891011121314151617181920212223
  1. module dipvars;
  2. % Determine distributive polynomial variables in a prefix form
  3. % Authors: R. Gebauer, A. C. Hearn, H. Kredel
  4. symbolic procedure dipvars u;
  5. % Returns list of variables in prefix form u
  6. dipvars1(u,nil);
  7. symbolic procedure dipvars1(u,v);
  8. if atom u then if constantp u or u memq v then v else u . v
  9. else if idp car u and get(car u,'dipfn)
  10. then dipvarslist(cdr u,v)
  11. else if u memq v then v
  12. else u . v;
  13. symbolic procedure dipvarslist(u,v);
  14. if null u then v
  15. else dipvarslist(cdr u,union(dipvars car u,v));
  16. endmodule;;end;