REDUCE

13.2 Interactive Editing

It is possible when working interactively to edit any REDUCE input that comes from the user’s terminal, and also some user-defined procedure definitions. At the top level, one can access any previous command string by the command ed(n), where n is the desired command number as prompted by the system in interactive mode. ED; (i.e. no argument) accesses the previous command.

After ED has been called, you can now edit the displayed string using a string editor with the following commands:

  B

move pointer to beginning

  Ccharacter

replace next character by character

  D

delete next character

  E

end editing and reread text

  Fcharacter

move pointer to next occurrence of character

  
  Istringescape

insert string in front of pointer

  Kcharacter

delete all characters until character

  P

print string from current pointer

  Q

give up with error exit

  Sstringescape

search for first occurrence of string, positioning pointer just before it

  space or X

move pointer right one character.

The above table can be displayed online by typing a question mark followed by a carriage return to the editor. The editor prompts with an angle bracket. Commands can be combined on a single line, and all command sequences must be followed by a carriage return to become effective.

Thus, to change the command x := a+1; to x := a+2; and cause it to be executed, the following edit command sequence could be used:

        f1c2e<return>.

The interactive editor may also be used to edit a user-defined procedure that has not been compiled. To do this, one says:

editdef id;

where id is the name of the procedure. The procedure definition will then be displayed in editing mode, and may then be edited and redefined on exiting from the editor.

Some versions of REDUCE now include input editing that uses the capabilities of modern window systems. Please consult your system dependent documentation to see if this is possible. Such editing techniques are usually much easier to use then ED or EDITDEF.