% $Id: choose.tex,v 1.1.1.2 2003/09/22 18:04:42 nthiery Exp $
\begin{Mhelppage}{choose}{Torsten Metzner}[ImplState=stable,TestState=stable,DocState=deprecated]
\begin{MInfo}
  \eng{k-subsets of a given set (deprecated)}
\end{MInfo}

\Mproofread{stefanw}{5.6.00}{fertig}

\begin{MIntro}
  \eng{\Mthis\Mex{(set,k)} computes all \Mpar{k}-subsets of the set
    \Mpar{set}
    
    \Mthis\Mex{(n,k)} computes all \Mpar{k}-subsets of the
    set \Mmath{{1,2,...,n}}{\{1,2,\ldots,n\}}.}
  
  \de{\large Noch keine deutsche Doku vorhanden}
\end{MIntro}

\begin{MCalls}
  \Mcall{set,k}
  \Mcall{n,k}
\end{MCalls}

\begin{MParameters}
  \param{set}
    \eng{a set of domain type \Mup{DOM_SET}}
  \param{k}
    \eng{a nonnegative integer}
  \param{n}
    \eng{a nonnegative integer}
\end{MParameters}

\begin{MReturnValue}
  \eng{\Mthis\ returns an expression sequence, consisting of the
    computed subsets.}
\end{MReturnValue}

\MKeywords{combinatorics}


\begin{MExample}{choose-1}
\eng{Compute all the subsets of \Mmath{a,b,c,d,e}{\{a,b,c,d,e\}}
  containing $3$ elements} 
\begin{Mexin}
combinat::warnDeprecated(FALSE):
combinat::choose({a,b,c,d,e},3)
\end{Mexin}
\begin{Mexout}
{a, b, c}, {a, b, d}, {a, b, e}, {a, c, d}, {a, c, e},

   {a, d, e}, {b, c, d}, {b, c, e}, {b, d, e}, {c, d, e}
\end{Mexout}

  \eng{\Mwarn{The function \Mup{combinat::choose} is deprecated:}}
  \begin{Mexin}
old_val:=combinat::warnDeprecated(TRUE):
combinat::choose({a,b,c,d,e},3);
combinat::warnDeprecated(old_val):
  \end{Mexin}
  \begin{Mexout}
Warning: combinat::choose(s,k) is obsolete.
Please use 'combinat::subsets::list(s,k)' instead. [combinat::\
choose]

{a, b, c}, {a, b, d}, {a, b, e}, {a, c, d}, {a, c, e},

   {a, d, e}, {b, c, d}, {b, c, e}, {b, d, e}, {c, d, e}
  \end{Mexout}

  \eng{Here is the recommended replacement:}
  \begin{Mexin}
combinat::subsets::list({a,b,c,d,e},3)
  \end{Mexin}
  \begin{Mexout}
[{a, b, c}, {a, b, d}, {a, b, e}, {a, c, d}, {a, c, e},

   {a, d, e}, {b, c, d}, {b, c, e}, {b, d, e}, {c, d, e}]
  \end{Mexout}
  \eng{Note that the result is returned as a list.}
\end{MExample}

\begin{MExample}{choose-2}
  \eng{Compute all the subsets of \Mmath{1,2,3}{\{1,2,3\}} containing
    $2$ elements}
  \begin{Mexin}
combinat::choose(3,2) 
  \end{Mexin}
  \begin{Mexout}
                    {1, 2}, {1, 3}, {2, 3}
  \end{Mexout}

  \eng{Here is the recommended replacement:}
  \begin{Mexin}
combinat::subsets::list(3,2)
  \end{Mexin}
  \begin{Mexout}
                   [{1, 2}, {1, 3}, {2, 3}]
  \end{Mexout}
\end{MExample}

\begin{MExample}{choose-3}
  \eng{It is not a good idea to compute the subsets containing $-1$
    element}
  \begin{Mexin}
combinat::choose({a,3},-1) 
  \end{Mexin}
  \begin{Mexout}
Error: Wrong type of 2. argument (type 'Type::NonNegInt' expec\
ted,
       got argument '-1');
during evaluation of 'combinat::choose'
  \end{Mexout}
\end{MExample}

\begin{MChanges}
  \version{2.0} 
  \none
  \version{2.5}%
  \eng[Deprecated function]{This function is temporarily retained for
    backward compatibility; however, its usage is strongly deprecated
    in favor of the library \Mup{combinat::subsets}. The emission
    of a warning can be controlled with
    \Mupc{combinat::warnDeprecated}{FALSE} or
    \Mupc{combinat::warnDeprecated}{TRUE}.}
\end{MChanges}

\end{Mhelppage}
