## `combinat::choose` -- Computes all k-subsets of a given set

#### Introduction

`combinat::choose``(set,k)` computes all `k`-subsets of the given set `set`

`combinat::choose``(N,k)` computes all `k`-subsets of the set `setN` where `setN =` 1,2,...,N.

#### Call(s)

`combinat::choose(set,k)`
`combinat::choose(N,k)`

#### Parameters

`set` | - | a set of domain type `DOM_SET`
`k` | - | a nonnegative integer
`N` | - | a nonnegative integer

#### Returns

`combinat::choose` returns an expression sequence, consisting of the computed subsets.

#### Example 1

Compute all the subsets of a,b,c,d,e containing 3 elements

    >> combinat::choose({a,b,c,d,e},3)

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

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

#### Example 2

Compute all the subsets of 1,2,3 containing 2 elements

    >> combinat::choose(3,2)

                              {2, 3}, {1, 3}, {1, 2}

#### Example 3

It's not a good idea to compute the subsets containing -1 element

    >> combinat::choose({a,3},-1)

          Error: Second argument must be a nonnegative integer [combinat\
          ::choose]

#### Changes

- no changes

Do you have questions or comments?
Copyright © SciFace Software GmbH & Co. KG 2000