Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

as.function.permutation

Coerce a permutation to a function


Description

Coerce a permutation to an executable function

Usage

## S3 method for class 'permutation'
as.function(x, ...)

Arguments

x

permutation

...

further arguments (currently ignored)

Note

Multiplication of permutations loses associativity when using functional notation; see examples

Author(s)

Robin K. S. Hankin

Examples

x <- cyc_len(3)
y <- cyc_len(5)

xfun <- as.function(x)
yfun <- as.function(y)

stopifnot(xfun(yfun(2)) == as.function(y*x)(2)) # note transposition of x & y

# written in postfix notation one has the very appealing form x(fg) = (xf)g

# it's vectorized:
as.function(rperm(10,9))(1)   
as.function(as.cycle(1:9))(sample(9))

permutations

The Symmetric Group: Permutations of a Finite Set

v1.0-9
GPL-2
Authors
Robin K. S. Hankin [aut, cre] (<https://orcid.org/0000-0001-5982-0415>), Paul Egeler [ctb] (<https://orcid.org/0000-0001-6948-9498>)
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.