December 4, 2022



We can now turn our attention to sequencable collections. M206 concentrates on three classes of fixed size sequenceable collections, Array, String and Symbol. The following table will illustrate some differences.

Class Element Growable Indexable Immutable
Array any object No Yes No
String Character No Yes No
Symbol Character No Yes Yes

Leaving aside symbols for a moment, we can imagine arrays and strings as a line of numbered boxes, each box holding an object, or a reference to an object.

Here is an array of five objects.

1 2 3 4 5
'Francis Bacon' fbaconDictionary setOfPubs birthDate 666

The next one contains ByteString objects.

1 2 3 4 5
'B' 'a' 'c' 'o' 'n'

But the following array is in fact a string, where each stored object is an instance of Character

1 2 3 4 5
$B $a $c $o $n

Next page » The protocol of Array

Previous page « Protocol of Dictionary
































































Up to top of page