# permutations -- produce all permutations of a list

## Synopsis

• Usage:
permutations x
• Inputs:
• Outputs:
• a list of all the permutations of the visible list x, or, if x is an integer, of the list of integers from 0 through n-1

## Description

 i1 : permutations {a,b,c,d} o1 = {{a, b, c, d}, {a, b, d, c}, {a, c, b, d}, {a, c, d, b}, {a, d, b, c}, ------------------------------------------------------------------------ {a, d, c, b}, {b, a, c, d}, {b, a, d, c}, {b, c, a, d}, {b, c, d, a}, ------------------------------------------------------------------------ {b, d, a, c}, {b, d, c, a}, {c, a, b, d}, {c, a, d, b}, {c, b, a, d}, ------------------------------------------------------------------------ {c, b, d, a}, {c, d, a, b}, {c, d, b, a}, {d, a, b, c}, {d, a, c, b}, ------------------------------------------------------------------------ {d, b, a, c}, {d, b, c, a}, {d, c, a, b}, {d, c, b, a}} o1 : List i2 : permutations 3 o2 = {{0, 1, 2}, {0, 2, 1}, {1, 0, 2}, {1, 2, 0}, {2, 0, 1}, {2, 1, 0}} o2 : List

## Ways to use permutations :

• "permutations(VisibleList)"
• "permutations(ZZ)"

## For the programmer

The object permutations is .