history.hlp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. How to use the history mechanism implemented in PSL/FRL:
  2. PSL/FRL allows you to take any previous input or output and substitute
  3. it in place of what you typed. Thus you can either print or redo
  4. any input you have previously done. You can also print or
  5. execute any result you have previously received.
  6. The system will work identify commands by either their history number,
  7. or by a subword in the input command.
  8. PSL/FRL also allows you to take any previously expression and do
  9. global substitutions on subwords inside words or numbers inside
  10. expressions(Thus allowing spelling corrections, and other word
  11. changes easily.)
  12. PSL/FRL is a set of read macros that insert the previous history
  13. text asked for inplace of them selves. Thus they can be put inside
  14. any lisp expression typed by the user. The system will evaluate
  15. the resulting expression the same as if the user had retyped everything
  16. in himself.
  17. ^^ : means insert last input command inplace of ^^.
  18. As an input command by itself,
  19. ^^ by itself means redo last command.
  20. ^n : where n is a number replaces itself with the result of
  21. (inp n). ^n by itself means (redo n).
  22. ^+n : same as ^n.
  23. ^-n : is replaced by the nth back command.
  24. replaced with the result of
  25. (inp (- current-history-number n)).
  26. by itself means (redo (- current-history-number n))
  27. ^word : where word starts with 'a'-'z' or 'A'-'Z', means
  28. take the last input command that has word as a subword
  29. or pattern of what was typed (after readmacros were
  30. executed.), and replace that ^word with that entire input
  31. command.
  32. If you want a word that doesn't begin with 'a'-'z', or 'A'-'Z',
  33. use ^?word where word can be any lisp atom.
  34. (say 23, *, |"ab|, word).
  35. ex.: 1 lisp> (plus 2 3)
  36. 5
  37. 2 lisp> (* 4 5)
  38. 20
  39. 3 lisp> ^us
  40. (PLUS 2 3)
  41. 5
  42. 4 lisp> (* 3 ^lu)
  43. (PLUS 2 3)
  44. 15
  45. Case is ignored in word. Word is read by the command read,
  46. And thus should be a normal lisp atom. Use the escape
  47. character as needed.
  48. If the first ^ in any of the above commands is replaced with
  49. ^@, then instead of (inp n) , the read macro is replaced with
  50. (ans n). Words are still matched against the input, not the
  51. answer. (Probably something should be added to allow matching
  52. of subwords against the answer also.)
  53. Thus:(if typed as commands by themselves):
  54. ^@^ = (eval (ans (last-command)))
  55. ^@3 = (eval (ans 3))
  56. ^@plus = (eval (ans (last-command which has plus as a subword in
  57. its input))).
  58. Once the ^ readmacro is replaced with its history expression, you are
  59. allowed to do some editing of the command. The way to do this
  60. is to type a colon immediately after the ^ command as described
  61. above before any space or other delimiting character.
  62. ex.: ^plus:p
  63. ^2:s/ab/cd/
  64. ^^:p
  65. ^@^:p
  66. Currently there are two types of editing commands allowed.
  67. :p means print only, do not insert in expression, whole
  68. read macro returns only nil.
  69. :s/word1/word2/ means take each atom in the expression found,
  70. and if word1 is a subword of that atom, replace the
  71. subword word1 with word2. Read is used to read word1
  72. and word2, thus the system expects an atom and will
  73. ignore anything after what read sees before the /.
  74. Use escape characters as necessary.
  75. :n where n is a positive unsigned number, means take the nth
  76. element of the command(must be a list) and return it.
  77. ^string1^string2^ is equivalent to :s/string1/string2/.
  78. ex.: ^plus^plus^times^ is equivalent to ^plus:s/plus/times/ .
  79. After a :s, ^ or :<n> command you may have another :s command, ^
  80. or a :p
  81. command. :p command may not be followed by any other command.
  82. The expression as modified by the :s commands is what is
  83. returned in place of the ^ readmacro.
  84. You need a closing / as seen in the :s command above.
  85. After the command you should type a delimiting character if
  86. you wish the next expression to begin with a :, since a :
  87. will be interpreted as another editing command.
  88. On substitution, case is ignored when matching the subword,
  89. and the replacement subword
  90. is capitalized(unless you use an escape character before
  91. typing a lowercase letter).
  92. Examples:
  93. 1 lisp> (plus 23 34)
  94. 57
  95. 2 lisp> ^^:s/plus/times/
  96. (TIMES 23 34)
  97. 782
  98. 3 lisp> ^plus:s/3/5/
  99. (PLUS 25 54)
  100. 79
  101. 4 lisp>