reduce2.writeup.wf.8 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. SPECIAL KEYPUNCH
  2. WIDTH OF COLUMN IS 65
  3. SENTENCES SEPARATED BY 2 BLANKS
  4. REPEAT TITLE
  5. TEXT STARTS ON LINE 5 IN POSITION 1
  6. INDENT (5,0),(10,0),(15,0),(20,0),(25,0)
  7. TABS AT 6 11 16 21 26 31 36 41
  8. NO CAPITALIZE
  9. TITLE 1
  10. 9COMPUTING CENTER MEMO #M182ñññññññññMTA/7-14-71
  11. )E
  12. GO
  13. )LLLL )M REDUCE 2 )M
  14. )LLLL )P This memo describes the programming language REDUCE 2 and how to use it in MTS. REDUCE 2
  15. is an improved version of REDUCE 1 (See CCMemo #M134) and will replace it. By the end of 1971 the
  16. REDUCE 1 language will be removed from MTS and all those using it should switch to REDUCE 2. This
  17. should present little trouble since the languages are similar and since REDUCE 2 is much easier to
  18. use. Most of the annoying problems in REDUCE 1, especially error handling, have been corrected in
  19. REDUCE 2.
  20. )P REDUCE 2 is intended primarily as an interactive algebraic programming system. However, it
  21. may also be used in batch mode, and it contains facilities for solving general symbolic computations
  22. either in batch mode or interactively.
  23. )P The bulk of this memo consists of the manual for REDUCE 2 from the Stanford Artificial Intelligence
  24. Project. The remainder of these introductory pages describe changes made to REDUCE 2 in MTS and features
  25. not mentioned in the manual. It should be noted that the Stanford manual was written for a version of
  26. REDUCE 2 that uses a different character set than is available in MTS. This should be only a minor
  27. problem since most characters used in the manual which exists in MTS have the same meaning. The
  28. complete set of characters that are used for operators in REDUCE 2 in MTS is given below. (See page
  29. 2-4 in the manual for Stanford's set)
  30. )V
  31. TABS AT 6 20 35
  32. GO
  33. )LLT MTS )T OPERATOR )T CHARACTER
  34. )LT )U Character )U )T )U Name )U )T )U used in manual )U
  35. )LT := )T SETQ )T <
  36. )LT & )T AND )T /
  37. )LT | )T OR )T V
  38. )LT ~ )T NOT )T ~
  39. )LT = )T EQUAL )T =
  40. )LT ~= )T UNEQ )T =
  41. )LT >= )T GREATEQ )T >=
  42. )LT > )T GREATERP )T >
  43. )LT <= )T LESSEQ )T <=
  44. )LT < )T LESSP )T <
  45. )LT + )T PLUS )T +
  46. )LT - )T MINUS )T -
  47. )LT * )T TIMES )T *
  48. )LT / )T QUOTIENT )T /
  49. )LT ** )T EXPT )T |
  50. )LLLL )P There are two commands and one operator available in REDUCE 2 in MTS which are not mentioned in
  51. the manual.
  52. )V
  53. TABS AT 6 20
  54. INDENT (5,0),(19,0)
  55. GO
  56. )LLT MTS; )TH2 Return control to MTS in such a way that $RESTART will return to REDUCE. Can be used to
  57. inspect or modify files while running REDUCE.
  58. )H2
  59. )LLT RETRY; )TH2 Attempt to reexecute the last REDUCE command that resulted in an error comment
  60. during execution. Commands entered with incorrect syntax (for example missing parentheses) will not
  61. be saved and can not be retried.
  62. )H2
  63. )LLT SOLVE(L,R) )TH2 An operator with two matrix operands which will solve a set of linear equations.
  64. L is the left hand side matrix and R in the right hand side matrix for one or more right hand sides.
  65. )H2
  66. )P The remainder of this introduction consists of individual corrections to the REDUCE manual. Each
  67. is given with a page reference. For information on running REDUCE in MTS see Appendix B.
  68. )LLT Page 2-1: )TH2 Numbers in this version of REDUCE are limited to the range -2147483648 to 2147483647
  69. (-2**31 to 2**31-1)
  70. )H2
  71. )LLT Page 2-2: )TH2 An identifier may be up to 80 characters long
  72. )H2
  73. )LLT Page 2-4: )TH2 See the character set table above.
  74. )H2
  75. )LLT Page 2-12: )TH2 The result of the evaluation of an expression is printed )U only )U if it is entered
  76. directly in the input stream or from a file (and if it is ended with a ;). It will not be printed if
  77. evaluated as part of a user defined operator.
  78. )H2
  79. )LLT Page 2-18: )TH2 A file name for use in the IN and OUT commands can be )U either )U an identifier
  80. )U or )U a string enclosed in quotes. For example IN FILE; or OUT "-T"; Note that if the file name
  81. does not follow the rules for an identifier, it must be enclosed in quotes. A logical unit name (eg.
  82. SPUNCH) can be used in an IN or OUT command.
  83. )H2
  84. )LLT Page 2-18: )TH2 An output file is )U not )U erased before its first use (use the MTS command $EMPTY
  85. for this) and additional output will be appended to the end of a file only if no intervening SHUT command
  86. is given for it.
  87. )H2
  88. )LLT Page 2-19: )TH2 IN T; will cause input to be taken from SCARDS and OUT T; will cause output to be
  89. written on SPRINT.
  90. )H2
  91. )S
  92. )LLT Page 2-19: )TH2 The absence of a SHUT command will not cause output to be lost.
  93. )H2
  94. )LLT Page 3-10: )TH2 If a long expression is output with FORT mode on, it will be broken into two or
  95. more FORTRAN assignment statements without regard for parentheses. This will often result in an incorrect
  96. FORTRAN statement.
  97. )H2
  98. )LLT Page 6-5: )TH2 This version of LISP has no such thing as a MACRO and they can't be defined in REDUCE.
  99. )H2
  100. )LLT Page A-1: )TH2 The following commands should be added to the list given: MTS, RETRY, PAUSE, CONT,
  101. INDEX, and REMIND.
  102. )H2
  103. )LLT Page C-4: )TH2 The reference to page B-2 should be to page C-2.
  104. )H2
  105. )S
  106. )LLLL )M Appendix B )M
  107. )LLLLB.1 Running REDUCE in MTS
  108. )P The commands necessary to run REDUCE in MTS are stored in the public file *REDUCE2. All that is
  109. necessary to run REDUCE is
  110. )LLTT $SOURCE *REDUCE2
  111. )LL This will cause the LISP interpreter to be loaded and REDUCE to be restored from a file. The process
  112. of restoring REDUCE takes several seconds, be patient. When LISP and REDUCE have been loaded, REDUCE will
  113. automatically be started and will print a heading identifying the version being used. The only way to get
  114. back into LISP is to enter an END; command, errors will not cause this.
  115. )P When the REDUCE heading is printed the system is ready for REDUCE commands. If commands are stored in a
  116. file use the IN command to cause them to be executed. (See page 2-18). An end of file from the terminal
  117. (or batch job) will unload REDUCE and LISP, and return to MTS.
  118. )P An example of the use of REDUCE is in the file *REDUCE2EXAMP. To print it use the following MTS
  119. command (in Batch)
  120. )LLTT $COPY *REDUCE2EXAMP
  121. )E