Del

From NARS2000
Jump to: navigation, search

∇ — Edit User Function — Keystroke ALT+G — Character 8711 or x2211

APLKB-Del.png

Usage

Main Article: Functions

The Del symbol is the equivalent of the declaration of a new Function, Procedure, or Subroutine in other programming languages. or a request to edit an existing function. Functions in APL may or may not return a value. In NARS 2000, unlike other APL systems, the ∇ symbol is only used to edit the function, it is not actually used in the header or the body of the function. The system command )EDIT may be used interchangeably with ∇.

The symbol is used to edit an APL function. There are two forms:

and

function

(or)

leftarg←function rightarg;local1;local2 etc.

where function is the name of the function to edit; leftarg← if used, is the result value of this function; rightarg, if used, is the argument to pass to the function; ;local1 etc. are optional local variables used by the function. If the function exists, an edit window will be opened and the function will be shown in the window. If the function does not exist, a new edit window will open with an empty function other than the function name on line 0. If arguments or local variables were provided as part of the declaration of a new function, they will appear in the function header on line 0 as used in the definition which was given.

Function names, like variables, are case sensitive. PI, Pi, pI, and pi are four different identifiers.

If is used with no function name specified, a new edit window will open and a blank line 0 will be presented to allow you to enter the function header. The function header can be typed in to this window on line 0 (without using the prefix del () symbol.) Note that unlike the prior practice on older mainframe APL systems such as APL\360 or VSAPL from IBM, to close the edit window, you type Control-E, do not place the symbol on the function header or use it to attempt to close the function by placing it on the last line of the function. The function editor will raise a syntax error and refuse to save the function with a warning of a SYNTAX ERROR if a ∇ appears in the function header; having a ∇ within the function will result in a SYNTAX ERROR when the function is executed.

The symbol is treated exactly as the )EDIT command, a )EDIT used alone opens a blank window to edit a new function, )EDIT followed by the name of a function opens a window containing the existing function for editing, or opens a new window to define the contents of the function.

A new function may be defined via the )EDIT function or the symbol, so that

∇ z←function5 r;⎕IO

or

)EDIT z←function5 r;⎕IO

Are identical. Note that arguments are ignored on the symbol or )EDIT command if the function is already defined; if you want to change the function header of an already defined function, you must edit line 0 of the function directly.


See Also
System Commands System Variables and Functions Operators
Keyboard
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S §
Alt '
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S
Alt
Sh Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
= < >
~ § π .. ,
/ \ ¨ .
_ ¯ Ø b e g p r v x