Creating an Array: Difference between revisions
Content added Content deleted
No edit summary |
No edit summary |
||
Line 353: | Line 353: | ||
Note that inner arrays can be of different sizes, as are simply values of the outer array. |
Note that inner arrays can be of different sizes, as are simply values of the outer array. |
||
==[[Pop11]]== |
|||
[[Category:Pop11]] |
|||
Pop11 distinguishes between vectors and arrays. Vectors are one dimensional |
|||
and the lowest index is 1. There is special shorthand syntax to create |
|||
vectors: |
|||
;;; General creation of vectors, create initialized vector. |
|||
vars v1 = consvector(1, 'a', "b", 3); |
|||
;;; Shorthand notation |
|||
vars v2 = {1 'a' b}; |
|||
;;; Create vector filled with word undef (to signal that elements |
|||
;;; are uninitialized |
|||
vars v3 = initv(3) |
|||
Pop11 arrays may have arbitrary lower and upper bounds: |
|||
;;; Create array with first index ranging from 2 to 5 and second |
|||
;;; index from -1 to 1, initialized with 0 |
|||
vars a1 = newarray([2 5 -1 1], 0); |
|||
==[[Python]]== |
==[[Python]]== |