Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
manual:chapter3:lists [2021/08/15 13:58] claudio [Operating with Lists] |
manual:chapter3:lists [2021/08/15 14:51] (current) claudio [Elements within a List] |
||
---|---|---|---|
Line 10: | Line 10: | ||
For example, lists can be used to quickly apply the same operation to more than one value: | 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 ==== |