[7.24] Use A Script For Self-Deleting Set-Up Programs - Texas Instruments TI-89 Tip List

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

When passing just the function name DOES work:
Sometimes you can pass the function and variable, and it will work. For example, suppose we use the
call
t(f1(x),x)
with this program
t(fxx,xx)
Prgm
local xval,result
10→xval
fxx|xx=xval→result
EndPrgm
In this case, the calculator will try to evaluate f1(x) when t() is called. If x is undefined, f1() will be
symbolically evaluated (if possible) with the variable x. This expression is then passed as fxx. Later in
the line fxx|xx=..., the symbolic expression is evaluated. For example, suppose that f1(x) is defined as
f1(x)
Func
2*x-3
EndFunc
so, the first evaluation (when t() is called) results in fxx = 2*x-3, which is then correctly evaluated later.
However, if the function performs a conditional test on x, the program will fail. For example, if we have
f1(x)
Func
if x>0 then
2*x-3
else
2*x+3
endif
EndFunc
the value of x is not defined at the time of the t(fxx,xx) call, so the program fails with the error message
A test did not resolve to TRUE or FALSE.
(credit for indirection method to Eric Kobrin)

[7.24] Use a script for self-deleting set-up programs

In general, a TI Basic program or function cannot delete itself. However, scripts (text files) can delete
themselves, and this can be used to create a self-deleting set-up process. For example, suppose that
the set-up program is called setup(), and the set-up script is called setscrpt. setscrpt looks like this:
:Press [f2] [5] to run setup
C:setup()
C:Delvar setup()
C:Delvar setscrpt
7 - 23

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents