StringTools[Permute] - apply a given permutation to a string
|
Calling Sequence
|
|
Permute( s, perm )
|
|
Parameters
|
|
s
|
-
|
Maple string
|
perm
|
-
|
list of integers; permutation of 1 .. length(s)
|
|
|
|
|
Description
|
|
•
|
The Permute(s, perm) command applies a given permutation perm to the string s.
|
•
|
The permutation perm must be a permutation of the integer , given as a list.
|
|
|
Examples
|
|
>
|
|
>
|
|
| (1) |
>
|
|
| (2) |
>
|
|
| (3) |
>
|
|
| (4) |
>
|
|
| (5) |
>
|
|
| (6) |
>
|
|
>
|
|
Using combinat[permute] you can construct all permutations of a string.
>
|
AllPermutations := proc( s::string )
local p;
seq( StringTools:-Permute( s, p ),
p = combinat[ 'permute' ]( length( s ) ) )
end proc:
|
>
|
|
| (7) |
>
|
|
| (8) |
|
|
Download Help Document
Was this information helpful?