Chapter 20: Lists
20.3. Saying lists of values

Any list L can be said:

let L1 be {2, 3, 5, 7, 11};
say L1;

produces the text "2, 3, 5, 7 and 11" - unless we have "Use serial comma." set, in which case a comma appears after the 7. We also have the option of using the more formal notation:

say L1 in brace notation;

which produces "{2, 3, 5, 7, 11}". (If we say a list of lists, then the individual entry lists are always printed that way: the ordinary sentence way would be incomprehensible.)

Of course, the values in L1 are written out in number form because L1 is a list of numbers: we could alternatively try

let L2 be {the piano, the music stand};
say L2;

which produces "piano and music stand". Lists of objects can be said in two additional ways:

"[L2 with definite articles]"
"[L2 with indefinite articles]"

which would produce "the piano and the music stand" and "a piano and a music stand" respectively.


PreviousContentsNext