Author Topic: TI 89 - InterActive -> size of an array  (Read 7156 times)

0 Members and 1 Guest are viewing this topic.

Offline kyllopardiun

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 178
  • Rating: +14/-4
  • Kyllopardiun over 2000 results in google.
    • View Profile
    • Kyllo's blog (a blog about poetry, videos and computing)
TI 89 - InterActive -> size of an array
« on: March 31, 2011, 08:45:48 pm »
Suppose you have a function like

Define a(Expression,[varlist],[varerror])=Func ...


How can I know how many terms the user used between each [] ?

 
I know that, if was a list such as a(expr,{varlist},{varerror})=func
I could do:
newMat(dim(varlist),1)

but with this workaround I can't re-use the function ...
as the output would be in the format[], and the input is a list .. :banghead:


Thanks for read this topic, and especially if can clarify how to do this!!

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: TI 89 - InterActive -> size of an array
« Reply #1 on: April 01, 2011, 04:59:10 am »
Try replacing dim() with coldim(). That should work :)

[] is a matrix, so coldim(["a","b","c"]) will return 3. But if you have ["a","b","c";"d","e","f"], it will also return 3, because ; start a new column. If you want anyway the amount of items in this situation, you will have to use coldim(varlist)*rowdim(varlist).

Happy coding!