Previous Up Next

6.4.1  Defining sets

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.3 for operations on lists.

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

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

Examples

set[1,2,3,4]

or:

     
⟦ 1,2,3,4⟧           
[1,2,5]
     

1,2,5
          

Previous Up Next