I bought a somewhat broken Ti-83 calculator a few years ago that came loaded with programs, one of which could factor polynomials. After the screen finally broke beyond repair, I forgot about it. I had a problem a few days ago that prompted me to dump the files from it to see if I could retrieve a program I had written, and came across it again. It isn't commented, has no author or date associated with it, and isn't indented. I messed around with it for a while and am now trying to translate it to TI Nspire Basic but there are a few weird things about it that I can't figure out. I'm pretty good with Nspire Basic and can interpret TI-x basic to a certain degree, but I guess I still have a few things to learn. If it helps, here it is [apparently I'm not allowed to post this. Its almost two hundred lines long and I don't think it would be appreciated if I pasted it all here]. I'm having trouble with the following few conventions…
Repeat D=⁻1 [...] End
The repeat loop isn't present in Nspire Basic (as far as I can tell), but based on the documentation, its equivalent to a Do loop in other languages, so i'm fairly certain that Nspire Basic equivalent of this loop would look like this:
Loop [...] if D=-1:Exit EndLoop
I'm not entirely certain, though, and don't currently possess the means to test it. Another problem I'm having involved the Not( command. Nspire Basic, just like TI-83 basic, has a Not( command, but it does something entirely different. The documentation says that its supposed to negate the input so that true becomes false, 1 becomes 0, etc (I'm not sure what it does when the input isn't boolean). In Nspire basic, not 0 equals -1, not 1 equals -2, and so on. It negates the input and then subtracts 1. It does, however, switch true/false properly. I'm pretty sure If not(D is equivalent to if D=0, but I'm not certain.
Thie line above is line 88 of the program. I'm not sure what the vertical line operator does, and I can't seem to find it in any documentation.
Changing the dimensions of lists seems to be a common and useful way to get things done in programs I've seen, but the capability to edit list length isn't clearly given in Nspire Basic, and although the operators and functions carry over from one to the other, this operation in particular is illegal. I'm pretty sure but not certain that that above code in Nspire Basic would be mid(L₃,1,dim(L₃)-1)→L₃ (which just cuts off the last value in the list). In cases like D+1→dim(L₁ where there aren't any preexisting values in the list, I'm guessing that the extra space is filled by zeros. In Nspire Basic, that would look like newList(D+1)→L₁ (once again, I'm uncertain and don't have the means to test these out). If the list already exists but is being extended, It would probably look like augment(L₁,newList(length)→L₁ where length is the number of items L₁ is being extended by. I've spent a while looking through the Nspire basic functions for some equivalent without success.
One other thing that I don't fully understand but believe is similar to that is this: abs(L₁(1→I%. What does this do? Is it some crazy way of writing abs(L₁(1))*100→I ?
The last issue I'm having is with readability. When I attempt to indent the code, no matter how carefully I do it, the loops and ‘End`s don’t line up (I've tried it a number of times starting from the beginning and the end). The only statements that get their own end statements are if:then, while, for, and repeat, right? As I've mentioned, I'm by no means an expert on TI-83 conventions, so some or all of the assumptions I've made here about the meaning/function of the TI-83 Basic commands could be false. I would appreciate any advice I can get on making sense of any of these things. I apologize for asking so many questions at once. I've just been researching for quite some time to reduce this list from what it used to be. Thanks!