I need to use augment to create a list, but it's not working. The list's name has to be something like ʟSOMETHING because I already used all the other lists in the program.
The code goes something like this:
Code: 12-> Xmin
3-> Xmax
SetupEditor ʟA
game loops start...
instructions...
randInt (1,6) -> I
...
augment( ʟA, {I})-> ʟA
end of game loops...
Disp ʟA
Problem is, LA isn't changing. Another game uses it so it already has stored values, which SetupEditor isn't deleting for some reason.
I need SetupEditor to work on ʟA, can someone help me?
Tell me if you need to whole code.
Code: 0->dim(LA)
SetupEditor LA
should do what you need. Setting its dim to 0 should work. Its been a while since I've used TI Basic, but if that does indeed give an Error, then you can do
Code: Delvar LA
ACagliano wrote:
Code: 0->dim(LA)
SetupEditor LA
should do what you need. Setting its dim to 0 should work. Its been a while since I've used TI Basic, but if that does indeed give an Error, then you can do
Code: Delvar LA
You first sugestion returns INVALID DIM and the second one returns UNDEFINED.
It doesn't work
Are you using the L token, and not the character L? Why not try
Fill(LA,0) (or it might be Fill(0,LA))
ACagliano wrote:
Are you using the L token, and not the character L? Why not try
Fill(LA,0) (or it might be Fill(0,LA))
Tried; doesn't work
SetupEditor doesn't delete exiting lists, it only creates them if they don't exist and unarchives them if needed.
Code: SetupEditor ʟA
1->dim(ʟA
agument(ʟA,{1
That will work, but you will then end up with your first number in your list being 0 but agument doesn't work with empty lists so this is the best I can come up with quickly.
If I remember correctly, you will need to adjust the dim( of a list if the size changes. I don't think TI-BASIC is smart enough to expand list sizes. If you know what size a list is going to be you can set it when you initialize the list. For example; if you needed a list with 6 entries you would do:
6→dim(ʟA).
If you need to change the size of a list, you can always modify the dimension as well. You can do: dim(ʟA)+1→dimʟ(A). This makes your list one size larger. Hope that helps.
If I understand the OP correctly, and if it's not too late(!), you don't need augment at all.
Just type:
I→ʟA(1+dim(ʟA
For instance, if ʟA has five entries this will store the value of I as its sixth entry: an augment of one entry in practice. This always works for the (n+1)th entry in a list, but would not work if you wanted to augment by several entries simultaneously, or store to a position more than one beyond the end of an existing list.
Art_of_camelot wrote:
I don't think TI-BASIC is smart enough to expand list sizes.
Yes it is, in the context above.
As OldMathTeacher says, TI-BASIC provides a nice way to extend a list by one element using the idiom that he showed in his code. It saves you the trouble of having to explicitly re-dimension the list; the longer and slower alternative would be:
Code: 1+dim(ʟA->dim(ʟA
I->ʟA(Ans
If you want to make sure that the list exists, then you could just do this simple way to create it.
0->LA(1)
if dim(LA)=1
0->LA(2)
Depending on the amount of the list you want to use, you can set more of the list. This makes sure that the list exists so that you can use it.
Not sure if this is relevant here, but another way to make sure that the list exists, and unarchive it is to use the SetUpEditor command. This will make sure that the list exists, and from there you can either check the dimensions of the list, or see if the first element is 0 and change it to something else if it is. This command can also be chained together. For example, to create List A and List B with dimensions of 0, you could do this:
Code: SetUpEditor A,B
Hopefully this is useful for something...
Yeah, i thought you were trying to say that SetUpEditor wasn't working so i gave you the long way around. sorry, i must not have understood the conversation.
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.
»
Go to Registration page
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum