## Permutation specific functions

`Base.isodd`

— Method`isodd(g::AbstractPermutation) -> Bool`

Return `true`

if g is an odd permutation and `false`

otherwise.

An odd permutation decomposes into an odd number of transpositions.

`Base.iseven`

— Method`isodd(g::AbstractPermutation) -> Bool`

Return `true`

if g is an even permutation and `false`

otherwise.

An even permutation decomposes into an even number of transpositions.

`Base.sign`

— Method`sign(g::AbstractPermutation)`

Return the sign of a permutation as an integer `±1`

.

`sign`

represents the homomorphism from the permutation group to the unit group of `ℤ`

whose kernel is the alternating group.

`AbstractPermutations.permtype`

— Function`permtype(g::AbstractPermutation)`

Return the group-theoretic type of permutation `g`

, i.e. the vector of lengths of cycles in the (disjoint) cycle decomposition of `g`

.

The lengths are sorted in decreasing order and cycles of length `1`

are omitted. `permtype(g)`

fully determines the conjugacy class of `g`

in the full symmetric group.

`AbstractPermutations.cycles`

— Function`cycles(g::AbstractPermutation)`

Return an iterator over cycles in the disjoint cycle decomposition of `g`

.

`AbstractPermutations.Lex`

— Type`Lex <: Base.Order.Ordering`

Lexicographical ordering of permutations.

The comparison of permutations `σ`

and `τ`

in Lexicographical ordering returns `true`

when there exists `k ≥ 1`

such that

`i^σ == i^τ`

for all`i < k`

and`k^σ < k^τ`

and `false`

otherwise.

The method `isless(σ::AbstractPermutation, τ::AbstractPermutation)`

defaults to the lexicographical order, i.e. calling `Base.lt(Lex(), σ, τ)`

.

See also `DegLex`

.

`AbstractPermutations.DegLex`

— Type`DegLex <: Base.Order.Ordering`

Degree-then-lexicographical ordering of permutations.

The comparison of `σ`

and `τ`

is made by comparing `degree`

s first, and by the lexicographical ordering among permutations of the same `degree`

.

See also `Lex`

.

## Function specific to actions on `1:n`

`AbstractPermutations.firstmoved`

— Function`firstmoved(g::AbstractPermutation, range)`

Return the first point from `range`

that is moved by `g`

, or `nothing`

if `g`

fixes `range`

point-wise.

`AbstractPermutations.fixedpoints`

— Function`fixedpoints(g::AbstractPermutation, range)`

Return the vector of points in `range`

fixed by `g`

.

`AbstractPermutations.nfixedpoints`

— Function`nfixedpoints(g::AbstractPermutation, range)`

Return the number of points in `range`

fixed by `g`

.

## The `@perm`

macro

`AbstractPermutations.@perm`

— Macro`@perm P cycles_string`

Macro to parse cycles decomposition as a string into a permutation of type `P`

.

Strings for the output of e.g. GAP could be copied directly into `@perm`

, as long as they are not elided. Cycles of length `1`

are not necessary, but can be included.

**Examples:**

Using the exemplary implementation from `test/perms_by_images.jl`

```
julia> p = @perm Perm{UInt16} "(1,3)(2,4)"
(1,3)(2,4)
julia> typeof(p)
Perm{UInt16}
julia> q = @perm Perm "(1,3)(2,4)(3,5)(8)"
(1,5,3)(2,4)
```