dipprint.red 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. module dipprint; %/* printing routines for distributive polynomials*/
  2. % Authors: R. Gebauer, A. C. Hearn, H. Kredel
  3. symbolic procedure diplprint u;
  4. % Prints a list of distributive polynomials using dipprint
  5. for each v in u do dipprint v;
  6. symbolic procedure dipprint u;
  7. % Prints a distributive polynomial in infix form
  8. <<terpri(); dipprint1(u,nil); terpri(); terpri()>>;
  9. symbolic procedure dipprint1(u,v);
  10. % Prints a distributive polynomial in infix form.
  11. % U is a distributive form. V is a flag which is true if a term
  12. % has preceded current form
  13. if dipzero!? u then if null v then dipprin2 0 else nil
  14. else begin scalar bool,w;
  15. w := diplbc u;
  16. if bcminus!? w then <<bool := t; w := bcneg w>>;
  17. if bool then dipprin2 " - " else if v then dipprin2 " + ";
  18. (if not bcone!? w or evzero!? x then <<bcprin w; dipevlpri(x,t)>>
  19. else dipevlpri(x,nil))
  20. where x = dipevlmon u;
  21. dipprint1(dipmred u,t) end;
  22. symbolic procedure dipprin2 u;
  23. % Prints u, preceding by two EOL's if we have reached column 70
  24. <<if posn()>69 then <<terpri(); terpri()>>; prin2 u>>;
  25. endmodule;;end;