farith.red 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. module farith; % Operators for fast arithmetic.
  2. % Authors: A. C. Norman and P. M. A. Moore, 1981.
  3. symbolic procedure iplus2(u,v); u+v;
  4. symbolic procedure itimes2(u,v); u*v;
  5. symbolic procedure isub1 a; a-1;
  6. symbolic procedure iadd1 a; a+1;
  7. remprop('iminus,'infix);
  8. symbolic procedure iminus a; -a;
  9. symbolic procedure idifference(a,b); a-b;
  10. symbolic procedure iquotient(a,b); a/b;
  11. symbolic procedure iremainder(a,b); remainder(a,b);
  12. symbolic procedure igreaterp(a,b); a>b;
  13. symbolic procedure ilessp(a,b); a<b;
  14. symbolic procedure iminusp a; a<0;
  15. symbolic smacro procedure iequal(u,v); eqn(u,v);
  16. newtok '((!#) hash);
  17. newtok '((!# !+) iplus2);
  18. newtok '((!# !-) idifference);
  19. newtok '((!# !*) itimes2);
  20. newtok '((!# !/) iquotient);
  21. newtok '((!# !>) igreaterp);
  22. newtok '((!# !<) ilessp);
  23. newtok '((!# !=) iequal);
  24. infix #+,#-,#*,#/,#>,#<,#=;
  25. precedence #+,+;
  26. precedence #-,-;
  27. precedence #*,*;
  28. precedence #/,/;
  29. precedence #>,>;
  30. precedence #<,<;
  31. precedence #=,=;
  32. deflist('((idifference iminus)),'unary);
  33. deflist('((iminus iminus)),'unary);
  34. deflist('((iminus iplus2)), 'alt);
  35. endmodule;
  36. end;