Skip to content

Commit 82159af

Browse files
authored
Remove composition (#39)
1 parent 33984fb commit 82159af

File tree

4 files changed

+3
-52
lines changed

4 files changed

+3
-52
lines changed

docs/src/operations.md

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -80,23 +80,3 @@ julia> for (x,y) in b; println("$x --> $y"); end
8080
1 --> alpha
8181
```
8282

83-
84-
85-
86-
87-
## Composition
88-
89-
Given two `Bijection`s `a` and `b`, their composition `c = a*b` is a new
90-
`Bijection` with the property that `c[x] = a[b[x]]` for all `x` in the
91-
domain of `b`.
92-
93-
```
94-
julia> a = Bijection{Int,Int}(); a[1] = 10; a[2] = 20;
95-
96-
julia> b = Bijection{String,Int}(); b["hi"] = 1; b["bye"] = 2;
97-
98-
julia> c = a * b;
99-
100-
julia> c["hi"]
101-
10
102-
```

src/Bijections.jl

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ end
2525
"""
2626
Bijection()
2727
28-
Construct a new `Bijection`.
28+
Construct a new `Bijection`.
2929
3030
* `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}`.
3131
* `Bijection(x::S, y::T)` creates a new `Bijection` initialized with `x` mapping to `y`.
32-
* `Bijection(dict::Dict{S,T})` creates a new `Bijection` based on the mapping in `dict`.
33-
* `Bijection(pair_list::Vector{Pair{S,T}})` creates a new `Bijection` using the key/value pairs in `pair_list`.
32+
* `Bijection(dict::Dict{S,T})` creates a new `Bijection` based on the mapping in `dict`.
33+
* `Bijection(pair_list::Vector{Pair{S,T}})` creates a new `Bijection` using the key/value pairs in `pair_list`.
3434
"""
3535
Bijection() = Bijection{Any,Any}()
3636

@@ -269,6 +269,4 @@ function Serialization.deserialize(
269269
return B(f)
270270
end
271271

272-
include("composition.jl")
273-
274272
end # end of module Bijections

src/composition.jl

Lines changed: 0 additions & 13 deletions
This file was deleted.

test/runtests.jl

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,6 @@ using Serialization
3838
@test Bijection(collect(b)) == b
3939
end
4040

41-
# check composition
42-
@testset "Composition" begin
43-
a = Bijection{Int,Int}()
44-
a[1] = 10
45-
a[2] = 20
46-
47-
b = Bijection{String,Int}()
48-
b["hi"] = 1
49-
b["bye"] = 2
50-
51-
c = a * b
52-
@test c["hi"] == 10
53-
end
54-
5541
# Test empty constructor
5642
@testset "empty_constructor" begin
5743
b = Bijection{Int,String}()

0 commit comments

Comments
 (0)