EasyManuals Logo

Texas Instruments TI-89 Tip List

Texas Instruments TI-89
507 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #100 background imageLoading...
Page #100 background image
listSwap({list},i1,i2)
Swaps the i1 and i2 elements of list
(Credit to Bhuvanesh Bhatt for the general index and address expressions and programs, the
transpos() function, and lots of help with this tip!)
[3.17] Conditional tests on lists
Suppose you have two lists L1 and L2 and you want to know if they are identical, that is, each element
of each list matches the other. The conditional '=' operator does not return a single true or false result
when applied to the lists. Even so, this conditional expression will resolve to a single true or false result
when used as the argument to an If ... EndIf or when() function. For example, this works:
If L1=L2 then
(... code for L1 = L2 goes here ...)
else
(... code for L1 L2 goes here ...)
endif
The other conditional operators also work for lists, for example:
L1 > L2 evaluates to true if each L1 element is greater than the corresponding L2 element
L1 < L2 evaluates to true if each L1 element is less than the corresponding L2 element
L1 L2 evaluates to true if each L1 element is not equal to the corresponding L2 element
(Credit to Ray Kremer)
[3.18] Swap list elements
There is no built-in function to swap two list elements. This function exchanges the elements of list at
locations i1 and i2:
listswap(list,i1,i2)
func
©(list,i1,i2) list[i1]<->list[i2]
©Swap list elements
©29nov00/dburkett@infinet.com
local x
list[i1]x
list[i2]list[i1]
xlist[i2]
list
Endfunc
For example,
listswap({a,b,c,d},1,4)
returns {d,b,c,a}.
3 - 18

Table of Contents

Other manuals for Texas Instruments TI-89

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Texas Instruments TI-89 and is the answer not in the manual?

Texas Instruments TI-89 Specifications

General IconGeneral
Display size (HxV)100 x 160 mm
Memory type639K FLASH ROM, 188K bytes RAM
Compatible operating systemsOperating System 2.09
Battery typeAAA

Related product manuals