FUNCTION EDITING
148
Several methods are used when in function definition mode to display and revise
a user-defined function. Also, after a function definition has been closed, the
definition can be reopened and the same methods used for further revisions or
displays. (See Reopening Function Definition in this chapter.)
Displaying a User-Defined Function
Once in function definition mode, part or all of a user-defined function can be
displayed as follows:
To display the entire function, including the function header and the opening
and closing V , enter [o]. APL responds by displaying the function, then wait-
ing for the entry of additional statements.
To display from a specified statement to the end of the function, enter [On],
where n is the specified statement number. APL responds by displaying the
function from statement n to the end of the function, then waiting for the
last statement displayed to be edited (see Editing Sraremenrs in this chapter).
To display only one statement of the function, enter [no], where n is the
statement number to be displayed. APL responds by displaying statement n
and waiting for the statement to be edited (see Ediring Statements in this
chapter).
The following table summarizes function display when in function definition mode:
Entry Result
[no1 Displays statement n
[On1
[ni Displays all statements
Displays all statements from n onward
Revising a User-Defined Function
Statements in a user-defined function can be
replaced, added, inserted, deleted, or
edited as follows:
To replace statement number n, enter [n] and the replacement statement. If
just [n] is entered, APL responds with [n], then waits for the replacement
statement to be entered. If the function header is to be replaced, enter [O]
and the new function header.
To add a statement, enter [n] (n can be any statement number beyond the
last existing statement number) and the new statement. APL will respond
with the next statement number, and additional statements can be entered if
required.
(I-
To insert a statement between existing statements, enter [n] and the new state-
ment. n can be any decimal number with up to 4 decimal digits. For example,
to insert a statement between statements 8 and 9, any decimal number be-
tween 8.0000 and 9.0000 can be used. APL will respond with another deci-
mal statement number and additional statements can be inserted between
statements 8 and 9 if required. (These and the following statements are auto-
matically renumbered when the function definition is closed.)
Note: The statement number 9999.9999 is the last valid statement number.
To delete statement n, enter [An].
Note: The [An] and closing 0 cannot be entered on the same line. If the func-
tion definition is to be closed immediately after a statement has been deleted,
the closing V must be entered on the next line.
To edit specific statement, use the following procedure:
1. Enter [nu] (where n is a statement number). Statement n is displayed.
2. Choose one of the following options:
a. To change a character, position the cursor (flashing character) at the
b. To delete a character, position the cursor at the character to be
character to be changed. Enter the correct character.
deleted. Then press the backspace ( 8) key while holding the
command (CMD) key. The character at the cursor is deleted from
the line and the characters that were to the right of the deleted char-
acter are moved one position to the left.
c. To insert a character, position the cursor to the position where the
PI’
character is to be inserted. Then press the forward space (
key while holding the command (CMD) key. The characters from the
cursor position to the end of the line are moved one position to the
right. For example: [I] At1245 should be [I] Ae12345. Position
the cursor at the 4 and press the forward space and command (CMD)
keys simultaneously. The display will look like this: [I] A+l2-45.
Now enter the 3.
d. To delete all or part of a line, press ATTN to delete everything from
the cursor position to the end of the line.
3. Press EXECUTE. The next statement number is displayed.
Note: If more than one statement number is entered on the same line, only the
last statement number is used. For example, if a line contained
[3] [8] [4] ‘NEW LINE’, only statement 4 is replaced when EXECUTE is pressed.
149
Previous Page Next Page