Ok, so I'm trying to define a list on the nspire, in TI-BASIC. I started with the L character, but I'm not sure that's correct, and I can't find an example.
I tried this:

Code:

Define test()=
Prgm
:lslist:=10
:x:=1
:lslist(x):="10"
:x:=x+1
:lslist(x):="12"
:dim(lslist):=1
:Disp lslist(1)&lslist(2)
:EndPrgm


But it didn't work. It displayed "1212". I also tried replacing x in the "lslist(x):=10, and the next instance, with 1 and 2 respectively, but it said that an argument could only be a variable.

Any Suggestions?
First, you cant set the dim of a list to 1, it is a function and only returns a value.
Second, use brackets for your list, otherwise the nspire treats it like a function.

Code:

 
Define test()= 
Prgm 
:lslist:={}
:x:=1 
:lslist[x]:="10" 
:x:=x+1 
:lslist[x]:="12"   
:Disp lslist[1]&lslist[2] 
:EndPrgm 
[/code]
Thanks, got it to work. Is there any way to set the length of a list, with or without using the dim?

The wiki says this:
Quote:


Code:

(84) :number→dim(list)

This sets the length of a list. All added elements are set to 0. All removed elements are simply erased. This version of the command will not work in TI-89.
dim is a function, not a property of any list
So is there a way to set the dim of a list, and just truncate everything else?
  
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
Page 1 of 1
» All times are UTC - 5 Hours
 
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

 

Advertisement