CoCoA:Permutations

From ApCoCoAWiki
Revision as of 10:02, 24 October 2007 by XMLBot (talk | contribs) (pushing XML rev. 1.46, again)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Permutations

returns all permutations of the entries of a list

Description

This function computes all permutations of the entries of a list (set).

If L has repeated elements it will return repeated elements.

Example

  Permutations(3..5);
[[3, 4, 5], [3, 5, 4], [4, 3, 5], [4, 5, 3], [5, 3, 4], [5, 4, 3]]
-------------------------------
  Permutations([2, 2, x]);
[[2, 2, x], [2, x, 2], [2, 2, x], [2, x, 2], [x, 2, 2], [x, 2, 2]]
-------------------------------
  MakeSet(Permutations([2, 2, x]));
[[2, 2, x], [2, x, 2], [x, 2, 2]]
-------------------------------

Syntax

Permutations(L: LIST): LIST

Subsets

Tuples

   <type>list</type>