`Bijections.Bijection`

— MethodConstruct a new `Bijection`

.

`Bijection{S,T}()`

creates an empty`Bijection`

from objects of type`S`

to objects of type`T`

. If`S`

and`T`

are omitted, then we have`Bijection{Any,Any}`

.`Bijection(x::S, y::T)`

creates a new`Bijection`

initialized with`x`

mapping to`y`

.`Bijection(dict::Dict{S,T})`

creates a new`Bijection`

based on the mapping in`dict`

.`Bijection(pair_list::Vector{Pair{S,T}})`

creates a new`Bijection`

using the key/value pairs in`pair_list`

.

`Base.:*`

— Method`(*)(a::Bijection{A,B}, b::Bijection{B,C})::Bijection{A,C} where {A,B,C}`

The result of `a * b`

is a new `Bijection`

`c`

such that `c[x]`

is `a[b[x]]`

for `x`

in the domain of `b`

. This function throws an error is `domain(a)`

is not the same as the `image`

of `b`

.

`Base.delete!`

— Method`delete!(b::Bijection,x)`

deletes the ordered pair `(x,b[x])`

from `b`

.1==

`Base.get`

— Method`get(b::Bijection, key, default)`

returns b[key] if it exists and returns default otherwise.

`Base.getindex`

— MethodFor a `Bijection`

`b`

and a value `x`

in its domain, use `b[x]`

to fetch the image value `y`

associated with `x`

.

`Base.inv`

— Method`inv(b::Bijection)`

creates a new `Bijection`

that is the inverse of `b`

. Subsequence changes to `b`

will not affect `inv(b)`

.

See also `active_inv`

.

`Base.isempty`

— Method`isempty(b::Bijection)`

returns true iff `b`

has no pairs.

`Base.length`

— Method`length(b::Bijection)`

gives the number of ordered pairs in `b`

.

`Base.setindex!`

— MethodFor a `Bijection`

`b`

use the syntax `b[x]=y`

to add `(x,y)`

to `b`

.

`Bijections.active_inv`

— Method`active_inv(b::Bijection)`

creates a `Bijection`

that is the inverse of `b`

. The original `b`

and the new `Bijection`

returned are tied together so that changes to one immediately affect the other. In this way, the two `Bijection`

s remain inverses in perpetuity.

See also `inv`

.

`Bijections.domain`

— Method`domain(b::Bijection)`

returns the set of input values for `b`

.

`Bijections.image`

— Method`image(b::Bijection)`

returns the set of output values of `b`

.

`Bijections.inverse`

— Method`inverse(b::Bijection,y)`

returns the value `x`

such that `b[x] == y`

(if it exists).