Previous Up Next

6.41.1  Defining a set or list: set[ ] %{ %}

Sets and lists are both collections of elements, and so have some operations in common. But lists are different from sets, because for a list, the order is important and the same element can be repeated in a list, while for sets order in not important and each element is unique. See Section 6.40 for operations on lists.

Recall (see Section 5.3.2) that to define a set of elements, you can put the elements, separated by commas, within delimiters %{ and %} or set[ and ].


Example.
Input:

set[1,2,3,4]

or:

%{1,2,3,4%}

Output:

⟦ 1,2,3,4⟧


Also, (see Section 5.3.3) to define a list of elements, you can put the elements, separated by commas, within delimiters [ and ]. Lists are also called vectors.


Example.
Input:

[1,2,5]

Output:


1,2,5

Previous Up Next