# Question:Sets????

## Question:Sets????

You use curly braces, ie '{}' as a container. Within Maple such curly braces designate a set, and Maple will always display sets in "lexicographic" order.

Since order has no meaning for entries in a set, trying to "sort" a set is meaningless. You can only sort lists, Arrays etc where the concept of order meaningful

See the attached for examples of sorting sets, lists, Arrays, and note that sorting of sets doesn't do anything useful

For future reference

1. This should be a "Question", not a "Post" (and if I knew how to move it I would!)
2. When posting on this site, try to avoid using third party sites like dropbox. Upload code (not pictures of code) using the big green up-arrow in the Mapleprimes toolbar
 > restart;   alpha:=[2,3,4,5]; # # Try sorting sets - won't work because # order is meaningless in a set #   sort( {abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)}, `<`);   whattype(%);   sort( {abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)}, `>`);   whattype(%); # # Do the same thing with lists, where order is significant #   sort( [abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)], `<`);   whattype(%);   sort( [abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)], `>`);   whattype(%); # # You can also sort entries in an Array() #   sort(Array([abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)]), `<`);   whattype(%);   sort(Array([abs(alpha[1]-30),abs(alpha[2]-30),abs(alpha[3]-30),abs(alpha[4]-30)]), `>`);   whattype(%);
 (1)
 >
 (2)
 >