Next: Implicit Convertions, Previous: The Intrinsic Types, Up: Types And Values [Index]
The aime ‘list’ is a fully referable data type. Objects of the ‘list’ type are heterogenouos collections.
See The List Library.
‘list’ objects may be referred any number of times, with the references being held by variables or other objects.
For the referable data types introduced by the aime libraries accompanying the interpreter, the ‘=’ assignment operation has a meaning different from that that applies to immediate types. It is not the object value that it is assigned, but the object reference. It is not that the object indicated by the left side variable is made to look like the one indicated by the right side value, it is that the left side variable is made to point the right side indicated object. The assignment operation for referable types can be taken to be congruent with the assignment for immediate types if it is noted the referable type values are not objects, but indications of objects.
list a, b;
Data may be added to ‘list’ collections in many ways.
l_append(a, 1); l_append(a, .5, "mandatory");
l_bill(b, 0, "lists", "may", "hold", "values", "of", "many", "types");
The two sequences indicated by the a and b variables record 3 and 7 items, respectively.
b = a;
Assigning a to b has b pointing the same object as a. The object formerly referred by b is now no longer referred and will be destroyed. Not only that the lengths of the sequences as indicated by a and b are now the same (3), but the sequences themselves are the same.
l_append(a, "wipe the virtue from your eyes");
Appending a datum to the sequence via one of the variable has the effect of modifying the length as retrievable via any of a and b. The:
o_form("~ ~\n", l_length(a), l_length(b));
will print now 4 4 (previously it would have printed 3 3 and before that 3 7).
‘list’ sequences may record references to objects, too.
l_link(a, -1, a);
The length of a (pointed) list is 5, with the item in the last position being a reference to the list itself.
Next: Implicit Convertions, Previous: The Intrinsic Types, Up: Types And Values [Index]