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 L
1
=L2 then
(... code for L
1
= L2 goes here ...)
else
(... code for L
1
≠
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,i
1
,i2)
func
©(list,i
1
,i2) list[i
1
]<->list[i2]
©Swap list elements
©29nov00/[email protected]
local x
list[i
1
]
→
x
list[i2]
→
list[i
1
]
x
→
list[i2]
list
Endfunc
For example,
listswap({a,b,c,d},
1
,4)
returns {d,b,c,a}.
3 - 18
Summary of Contents for TI-92+
Page 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Page 53: ...LCD connector detail PCB switch side 1 42...
Page 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Page 55: ...Key cap detail 1 44...
Page 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Page 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...