(
("""
--,/
C't
C
An
Example
of
Function Editing
In
this example, the user-defined function AVERAGE
is
used
to
show how
the
methods used
to
revise and display functions work:
VAVERAGE
X~·~~~~~~~~~~~~~~~~~~~Define
the function.
[1]
'THIS
FUNCTION
CALCULATES
AVERAGES'
[2]
+/X+(+/X~X)V
AVEI~AGE
2
4·
6
B~.~~~~~~~~~~-~~~~-Executeandtestthefunction.
THIS
FUNCTION
CALCULATES
AVERAGES
'VAVERAGE[:I.,7]
'THE
AVEI~AGE
IS·
.....
---------Insertastatement.
[1
,
B:1
[:1.0]·
Display statement
1.
[:1.] ·
THIS
FUNCTION
CALCULATES
AVERAGES
.~
[.I.]
'THIS
FUNCTION
CALCULATES
AVERAGES AND
SUMS'
Statement 1 was edited
~------------------
[2] [3]
'THE
BUM
IS'
to
look like this.
[",.]
+/XV
~~---
___
~~~~~~~~~~~~_
Add statements 3 and 4.
VAVERAGE[L1J'V~
'V
AVERAGE X
--~~~~~~--~--~~-Display
the function.
[1]
'THIS
FUNCTIDN
CALCULATES
AVERAGES AND
SUMS'
[2]
'THE
AVERAGE
IS'
[3]
+/X+(+/X=X)
[l.f.J
'THE
SUM
IS'
[5J
+/X
V
AVERAGE 2
'+
6 B
......
.--~~~~~~~~~~~~---Executeaverage.
THIS
FUNCTION
CALCULATES
AVERAGES AND SUMS
THE AVERAGE
IS
5
THE
SUM
IS
20
VAVERAGE
[~5J
+/X~·?)X
......
~~--~~-~~~~-~-Replace
statement 3.
[
4·
]
I::
1J.1::1
'II
Delete statement 1.
[,2]
I:
0
:1
AVE
I~AGEIJ.SlJM
XV.. Replace the function header.
[
:L
:I
[2J
[3J
[4·]
THE
c·
....
}
THE
20
[3J
[1+
:I
VAVERAGE~SUM[rJ]V
...
~~~-~~-----~-~~-Display
the
function.
'V
AVERAGEt.\SUM X
'THE
AVERAGE
IS'
+/X+pX
'THE
SUM
IS'
+/X
AVERAGEIJ.SUM 2
~
6 8
AVEI~AGE
IS
SUM
IS
VAVEI~AGEIlSUM
[[]3JV
....
_____________
.....-_Display the function from
'THE
SUM
IS'
statement 3
to
the end.
+/X
151