sets/quickref.tex
author Puneeth Chaganti <punchagan@fossee.in>
Tue, 09 Nov 2010 15:33:47 +0530
changeset 413 da1f270b07b7
parent 333 91b427241f8f
child 523 54bdda4aefa5
permissions -rw-r--r--
Change to progress.org

Creating a set:\\
{\ex \lstinline|   p10 = set([2, 3, 5, 7]) |t}

Creating set from a tuple or list:\\
{\ex \lstinline|   s = set(var_name)|}

Operations on sets. Ex: UNION:\\
{\ex \lstinline|   s1 \| s2 |}

Other operations available:\\

\begin{lstlising}
\item "\&" -- Intersection
\item "-" -- Difference
\item "\^" -- Symmetric Difference
\item "<" -- Subset
\end{lstlisting}

Checking for containership:\\
{\ex \lstinline|    x in p10|}

Finding the no.of elements:\\
{\ex \lstinline|    len(p10)|}