concept.tex 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. \section{Concepts}
  2. \begin{Type}{IDENTIFIER}
  3. Identifiers in REDUCE consist of one or more alphanumeric characters, of
  4. which the first must be alphabetical. The maximum number of characters
  5. allowed is system dependent, but is usually over 100. However, printing
  6. is simplified if they are kept under 25 characters.
  7. You can also use special characters in your identifiers, but each must be
  8. preceded by an exclamation point \name{!} as an escape character. Useful
  9. special characters are \name{\ # \$ \% ^ \& * - + = ? < > ~ | / !} and
  10. the space. Note that the use of the exclamation point as a special
  11. character requires a second exclamation point as an escape character.
  12. The underscore \name{\_} is special in this regard. It must be preceded
  13. by an escape character in the first position in an identifier, but is
  14. treated like a normal letter within an identifier.
  15. Other characters, such as \name{( ) # ; ` ' "} can also be used if
  16. preceded by a \name{!}, but as they have special meanings to the Lisp
  17. reader it is best to avoid them to avoid confusion.
  18. Many system identifiers have * before or after their names, or - between
  19. words. If you accidentally pick one of these names for your own identifier,
  20. it could have disastrous effects. For this reason it is wise not to include
  21. * or - anywhere in your identifiers.
  22. You will notice that REDUCE does not use the escape characters when it prints
  23. identifiers containing special characters; however, you still must use them
  24. when you refer to these identifiers. Be careful when editing statements
  25. containing escaped special characters to treat the character and its escape
  26. as an inseparable pair.
  27. Identifiers are used for variable names, labels for \name{go to} statements,
  28. and names of arrays, matrices, operators, and procedures. Once an identifier is
  29. used as a matrix, array, scalar or operator identifier, it may not be used
  30. again as a matrix, array or operator. An operator or array identifier may
  31. later be used as a scalar without problems, but a matrix identifier cannot be
  32. used as a scalar. All procedures are entered into the system as operators, so
  33. the name of a procedure may not be used as a matrix, array, or operator
  34. identifier either.
  35. \end{Type}
  36. \begin{Type}{KERNEL}
  37. A \name{kernel} is a form that cannot be modified further by the REDUCE
  38. canonical simplifier. Scalar variables are always kernels. The
  39. other important class of kernels are operators with their arguments.
  40. Some examples should help clarify this concept:
  41. \begin{TEX}
  42. \begin{center}
  43. \begin{tabular}{|l@{\hspace*{2cm}}|l|}
  44. \hline
  45. \multicolumn{1}{|c|}{Expression} & \multicolumn{1}{c|}{Kernel?}\\
  46. \hline
  47. \verb|x| & Yes\\
  48. \meta{varname} & Yes\\
  49. \verb|cos(a)| & Yes\\
  50. \verb|log(sin(x**2))| & Yes\\
  51. \verb|a*b| & No\\
  52. \verb|(x+y)**4| & No\\
  53. \meta{matrix identifier} & No\\
  54. \hline
  55. \end{tabular}
  56. \end{center}
  57. \end{TEX}
  58. \begin{INFO}
  59. {
  60. \begin{verbatim}
  61. Expression Kernel?
  62. x Yes
  63. varname Yes
  64. cos(a) Yes
  65. log(sin(x**2)) Yes
  66. a*b No
  67. (x+y)**4 No
  68. matrix-identifier No
  69. \end{verbatim}
  70. }
  71. \end{INFO}
  72. Many REDUCE operators expect kernels among their arguments. Error messages
  73. result from attempts to use non-kernel expressions for these arguments.
  74. \end{Type}
  75. \begin{Type}{STRING}
  76. A \name{string} is any collection of characters enclosed in double quotation
  77. marks (\name{"}). It may be used as an argument for a variety of commands
  78. and operators, such as \name{in}, \name{rederr} and \name{write}.
  79. \begin{Examples}
  80. write "this is a string"; & this is a string \\
  81. write a, " ", b, " ",c,"!"; & A B C!
  82. \end{Examples}
  83. \end{Type}