put element 12 of steve into billput element 2 through 7 of steve into billput the fifth element of steve into billput the third through eighth element of steve into billput element "andy" of steve into bill The element data type is a chunk type of list that represents individual items in a list. Every single value, piece of data, list, or object is considered an element of its containing list, or, if not in a list, an element of a single-element list containing it.
In order to use lists properly, you must declare your variables to be a kind of list. If a list is put into a variable that is undeclared, or declared to be a type other than a kind of list, the list will be converted to a single string. For example:
put (1,2,3,4) into steve put the number of elements in steve
will print 1 because steve has only one element: the string "1,2,3,4". However, this example:
local steve as numbers put (1,2,3,4) into steve put the number of elements in steve
will print 4 because steve has four elements: the numbers 1, 2, 3, and 4.
There is a subtle difference between an index, ordinal, or name descriptor and an index range, ordinal range, or mass descriptor for elements. An index, ordinal, or name descriptor evaluates to an item in the list, while an index range, ordinal range, or mass descriptor evaluates to a sublist. Consider the following:
local myList as list put (1,2,(3,4),5) into myList put the number of elements in element 3 of myList put the number of elements in element 3 to 3 of myList
The first line of output will be 2, since element 3 of myList is a list containing two values, 3 and 4. However, the second line of output will be 1, since element 3 to 3 of myList is a list containing that list.
The element and elements data types were broken in OpenXION 1.0 and 1.1, and evaluated index, ordinal, and name descriptors as sublists rather than list items. This was fixed in OpenXION 1.2.