APLX Help : Help on APL language : APL Primitives : ∇ Line editor
|
|
![]() |
|
Editing functions and Operators(For brevity, we use the word 'function' in this section to denote either user-defined functions or user-defined operators).
The editor prompts you with the next line number, in square brackets. (Note that the function header is line 0.) To enter a line for the line number which is being shown, just type the line. When you press Enter, the line will be fixed and you will be prompted with the next line number. By entering line numbers and other characters in square brackets, you can control the editor, as in the following examples: ∇NAME[⎕] Enter editor, open function NAME, list whole function [⎕] List function (once you have opened it) [⎕4] List from line 4 onwards [3] Overwrite line 3 [3] ... Overwrite line 3 immediately [5.1] Insert new line after line 5 [∆2] Delete line 2 from the function [4⎕6] Place cursor at line 4, character position 6 [4⎕0] Place cursor at end of line 4 [0⎕0] Place cursor at end of the function header To insert a line, use a fractional line number between the line numbers of the lines on either side of the insertion point. For example, [3.1] will insert a line between existing lines 3 and 4 (and you will be prompted with [3.2] as the next line). Note that you can edit the line number itself. This has the effect of copying the line to the new position, either inserting a new line, or overwriting an existing line. When you have finished editing, type another Defining or editing a class using the line editorThe line editor can also be used to create or edit a class, in much the same way as it is used to edit a function or operator.
To define a new class, open the line editor by entering a line which begins with the del ( ∇Sphere : Point { {Sphere}: You can then define properties by entering lines in the same format as the canonical representation of a class. After each line, APLX prompts again with the class name enclosed in curly braces: Radius←0 {Sphere}: You can also enter methods by using the del editor in the normal way (you will be prompted with the line number until you finish editing the method, then return to class-definition mode and again be prompted with the class name): ∇R←Volume [1] R←1.333333333333×(○1)×Radius*3 [2] ∇ {Sphere}: Finally, exit from class-definition mode by entering a single right curly brace: } The canonical representation of the class defined in this way would then be as follows: ⎕CR 'Sphere' Sphere : Point { Radius←0 ∇R←Volume R←1.333333333333×(○1)×Radius*3 ∇ } |
|
APLX Help : Help on APL language : APL Primitives : ∇ Line editor
|
Copyright © 1996-2010 MicroAPL Ltd