Module pl.permute
Permutation operations.
Dependencies: pl.utils, pl.tablex
Functions
iter (a) | an iterator over all permutations of the elements of a list. |
table (a) | construct a table containing all the permutations of a list. |
Functions
- iter (a)
-
an iterator over all permutations of the elements of a list.
Please note that the same list is returned each time, so do not keep references!
Parameters:
- a list-like table
Returns:
-
an iterator which provides the next permutation as a list
- table (a)
-
construct a table containing all the permutations of a list.
Parameters:
- a list-like table
Returns:
-
a table of tables
Usage:
permute.table {1,2,3} --> {{2,3,1},{3,2,1},{3,1,2},{1,3,2},{2,1,3},{1,2,3}}