Darwin Help

Back to Index

set

Class set - (mathematical) set of arbitrary elements

Calling Sequence  {}
{a}
{a,...}
Return Type  set
Selectors
NameTypeDescription

the ith element in the set 
the ith element from the right 
.. an expseq of elements from the set 
Methods Rand
Synopsis A set holds a set of arbitrary values or structures. Elements in the set are ordered according to a unique order, and repeated elements are removed. Elements of a set (when the user is sure where they are located), can be replaced with an assignment statement. When selecting with an integer range, negative values are interpreted as counting from the right. I.e. -2..-1 select the last two elements of the set. The sorting of sets is very efficient, so if order is desired, placing the information in sets may be more efficient.
Examples
> a := {b,1,2,[d,e]};
a := {1,2,b,[d, e]}
> a[1];
1
> a[1..2];
1, 2
> a[-1..-1];
[d, e]
> a[-2..-1];
b, [d, e]
> a[3] := 77;
a[3] := 77
> a;
{1,2,77,[d, e]}


See also append,   intersect,   list,   member,   minus,   mselect,   sort,   subset,   union