Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
manual:chapter3:lists [2021/08/15 13:55] claudio created |
manual:chapter3:lists [2021/08/15 14:51] (current) claudio [Elements within a List] |
||
---|---|---|---|
Line 7: | Line 7: | ||
==== Operating with Lists ==== | ==== Operating with Lists ==== | ||
- | In most cases, commands will accept a list instead of a single argument and will proceed according to the [[section | + | In most cases, commands will accept a list instead of a single argument and will proceed according to the [[manual: |
+ | For example, lists can be used to quickly apply the same operation to more than one value: | ||
+ | < | ||
+ | 2: { 1 2 3 } | ||
+ | 1: 1 | ||
+ | …………………………………………………………………………………… | ||
+ | + | ||
+ | </ | ||
+ | will result in adding '' | ||
+ | |||
+ | There' | ||
+ | |||
+ | < | ||
+ | 2: { 1 2 3 } | ||
+ | 1: 1 | ||
+ | …………………………………………………………………………………… | ||
+ | ADD | ||
+ | </ | ||
+ | will result in '' | ||
+ | < | ||
+ | 2: { 1 2 3 } | ||
+ | 1: { 4 5 6 } | ||
+ | …………………………………………………………………………………… | ||
+ | ADD | ||
+ | </ | ||
+ | will result in '' | ||
+ | |||
+ | Other common commands that operate on lists are: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | |||
+ | ==== Elements within a List ==== | ||
+ | |||
+ | Elements in a list can be referred to by a numeric index. The index starts at '' | ||
+ | < | ||
+ | 2: { 11 12 13 } | ||
+ | 1: 2 | ||
+ | …………………………………………………………………………………… | ||
+ | GET | ||
+ | </ | ||
+ | will result in '' | ||
+ | |||
+ | Replacing an element is done via the '' | ||
+ | |||
+ | < | ||
+ | 3: { 11 12 13 } | ||
+ | 2: 2 | ||
+ | 1: 3 | ||
+ | …………………………………………………………………………………… | ||
+ | PUT | ||
+ | </ | ||
+ | will result in '' | ||
+ | |||
+ | Elements of a list can also be accessed from within algebraic expression (read-only) by giving the list a name (store the list in a variable using '' | ||
+ | For example, assuming the list '' | ||
+ | ==== Procedures with Lists ==== |