.NH 1 Editing Functions .PP Function editing on \*u \*a differs from that on other \*a systems. The ``del'' character is not used. Instead, the \*u editor is used. There are two alternatives. .PP The ``)editf'' system command is used to edit a function residing in the internal workspace. The command .sp )editf fn .sp writes the function ``fn'' into a temporary file and calls the editor to process it. When the editor is finished, \*a reads it back in. .PP The command: .sp )edit junk .sp invokes the editor to process the \*u file ``junk''. When the editor is terminated via the ``q'' command, control returns to \*a, which will read ``junk'' into the internal workspace. Note that this method involves files external to \*a. ``)editf'' is generally a better choice since it allows all information relating to the workspace to be contained within the workspace. .PP Because of the way in which editing is performed, there are two points which need special attention. First, it is not possible to edit a suspended function. (For a description of suspended functions and how to reset them, see ``The State Indicator''.) Second, if the function header (first line of the function) contains a syntax error, \*a will .I not read in the function. In general, this means that the function is no longer defined in the workspace, and the only other copy exists in a temporary file. In order to save you a lot of work retyping, \*a will automatically copy the temporary file into a file called ``apl.badfn'' .PP An example is probably called for at this point to clear the mud somewhat. The following shows the creation of the function ``fact'' which computes factorials by multiplication. .DS )editf fact [new fn] XED 0 lines >a [ 0 ] n { fact+i [ 1 ] n { 1 [ 2 ] loop: } (i = 0) / 0 [ 3 ] n { n X i [ 4 ] i { i - 1 [ 5 ] } loop [ 6 ] . >w >q n { fact+i ^ syntax error Function saved in apl.badfn .DE The error in line 0 (``fact+i'') caused \*a to stop reading the function, so it was automatically copied to the file ``apl.badfn''. To get it back, you can say: .DS )editf fact [new fn] XED 0 lines >r apl.badfn 5 lines >0s/+/ /p [ 0 ] n { fact i >w >q .DE .PP If you use ``)edit'' instead of ``)editf'', \*a will not worry about saving the function in ``apl.badfn'' because you were editing from a \*u file rather than the internal workspace, and that file still exists.