HP Forums
Acces to a list - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html)
+--- Forum: HP Prime (/forum-5.html)
+--- Thread: Acces to a list (/thread-4757.html)



Acces to a list - Powersoft - 09-20-2015 06:56 PM

Hi all,

Need some help with my list.

L1 ={{1,2,3},{4,5,6},{8,9,1},{7,6,1}}

1. How to calculate the amount of elements (4)?
2. How to access every separate element of list L1

Thanks, for any help!

Cheers

Jan


RE: Acces to a list - Tim Wessman - 09-21-2015 12:39 AM

1. SIZE
2. L1(<number>) to access further down inside, L1(<number>,<number>...) Ex: L1(2,3) returns 6 in your given list.


RE: Acces to a list - cyrille de brébisson - 09-21-2015 05:54 AM

Hello,

Var[n] refers to:
if var is a list: the nth element of the list
if var is a string, the nth char of the string
if var is a vector, the nth element of the vector
if var is a matrix, the nth line of the matrix, or if n<0, the nth column
if var is an int, the nth bit of the int.

This works both in RCL and STO

var[n, m] refers to:
if var is a list: var[m] for the nth element of the list (parameter list can be up to 16 long!)
if var is a string, m chars starting at index n in the string
if var is a matrix, the element at pos n,mx
if var is an int, the m bit starting at pos n from the int

list(0):=val: adds at the end of the list

That should get you started.
Cyrille