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 #115 background imageLoading...
Page #115 background image
// throw the appropriate error if the user enters too many or
// too few arguments, or doesn't enter a LIST or MATRIX
if (argumentNumber > 2)
ER_throwVar (940);
if (argumentNumber < 2)
ER_throwVar (930);
if (*listPointer != LIST_TAG)
ER_throwVar (90);
// get a pointer to the second argument
itemPointer = next_expression_index (listPointer);
// decrement listPointer so it points to first element in list
listPointer--;
// designate the end of the list of indices that will be
// pushed to the expression stack
push_quantum (END_TAG);
// step through the list, examining each element to see
// if it matches target item; if it does, add its
// position to the list
while (*listPointer != END_TAG)
{
// compare_expressions returns 0 if the items match
if (compare_expressions(listPointer, itemPointer) == 0)
push_longint (index);
// advance pointer to the next element
listPointer = next_expression_index (listPointer);
index++;
}
// list on the top of the stack is in descending order, so
// reverse the list so items are in ascending order
push_reversed_tail (top_estack);
push_quantum (LIST_TAG);
// estack clean up
itemPointer = next_expression_index (top_estack);
while (*itemPointer != END_TAG)
{
listPointer = itemPointer;
itemPointer = next_expression_index (itemPointer);
delete_expression (listPointer);
}
} // main
(Credit to Brett Sauerwein for the C version)
3 - 33

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