rtrace.tst 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. % rtrace.tst -- Test portable REDUCE tracing
  2. % Author: Francis J. Wright, 13 July 1998
  3. symbolic procedure test(a, b);
  4. begin scalar c, d;
  5. d := c := {a, b};
  6. return c
  7. end$
  8. rtr test;
  9. getd 'test;
  10. prop 'test;
  11. test('a, 'b);
  12. rtrst test;
  13. getd 'test;
  14. prop 'test;
  15. test('a, 'b);
  16. unrtr test;
  17. getd 'test;
  18. prop 'test;
  19. test('a, 'b);
  20. algebraic procedure test(a, b);
  21. begin scalar c, d;
  22. d := c := {a, b};
  23. return c
  24. end$
  25. rtr test;
  26. getd 'test;
  27. prop 'test;
  28. test(a, b);
  29. rtrst test;
  30. getd 'test;
  31. prop 'test;
  32. test(a, b);
  33. unrtr test;
  34. getd 'test;
  35. prop 'test;
  36. test(a, b);
  37. algebraic procedure test(a, b);
  38. d := c := {a, b}$
  39. rtr test;
  40. getd 'test;
  41. prop 'test;
  42. test(a, b);
  43. rtrst test;
  44. getd 'test;
  45. prop 'test;
  46. test(a, b);
  47. unrtr test;
  48. getd 'test;
  49. prop 'test;
  50. test(a, b);
  51. % Examples used in documentation (rtrace.tex):
  52. algebraic procedure power(x, n);
  53. if n = 0 then 1 else x*power(x, n-1)$
  54. rtr power;
  55. power(x+1, 2);
  56. off rtrace;
  57. power(x+1, 2);
  58. on rtrace;
  59. unrtr power;
  60. rtr int;
  61. unrtr int;
  62. procedure fold u;
  63. for each x in u sum x$
  64. rtrst fold;
  65. fold {z, z*y, y};
  66. unrtrst fold;
  67. trigrules := {sin(~x)^2 => 1 - cos(x)^2};
  68. let trigrules;
  69. trrl trigrules;
  70. 1 - sin(x)^2;
  71. untrrl trigrules;
  72. trrl sin;
  73. 1 - sin(x)^2;
  74. untrrl sin;
  75. clearrules trigrules;
  76. trrlid trigrules;
  77. 1 - sin(x)^2 where trigrules;
  78. untrrlid trigrules;
  79. end;