diff --git a/.github/workflows/benchmarks.yml b/.github/workflows/benchmarks.yml index 5a11f6f2f..9c1b4bd8c 100644 --- a/.github/workflows/benchmarks.yml +++ b/.github/workflows/benchmarks.yml @@ -8,7 +8,7 @@ jobs: - name: Set up Julia uses: julia-actions/setup-julia@latest with: - version: 1.6 + version: 1.7 - name: Install dependencies run: julia -e 'using Pkg; pkg"add PkgBenchmark BenchmarkCI@0.1"' - name: Run benchmarks diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 425d6765e..0b84c4cf1 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -9,7 +9,7 @@ jobs: - uses: actions/checkout@v2 - uses: julia-actions/setup-julia@latest with: - version: '1.6' + version: '1.7' - name: "Install system dependencies" run: | sudo apt-get update diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 29a5b7b62..506a62ccf 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -8,7 +8,7 @@ jobs: - name: "Set up Julia" uses: julia-actions/setup-julia@latest with: - version: '1.6' + version: '1.7' - name: "Install system dependencies" run: | sudo apt-get update diff --git a/.github/workflows/downstream.yml b/.github/workflows/downstream.yml index f147b60fb..b6a1b610f 100644 --- a/.github/workflows/downstream.yml +++ b/.github/workflows/downstream.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - julia-version: ['1.6'] + julia-version: ['1.7'] os: [ubuntu-latest] package: - {user: AlgebraicJulia, repo: AlgebraicDynamics.jl} diff --git a/.github/workflows/experiments.yml b/.github/workflows/experiments.yml index 64b1b403f..7a4da5da3 100644 --- a/.github/workflows/experiments.yml +++ b/.github/workflows/experiments.yml @@ -13,7 +13,7 @@ jobs: - name: "Set up Julia" uses: julia-actions/setup-julia@latest with: - version: '1.6' + version: '1.7' # XXX: Cannot change working directory for "uses" steps. #- name: "Run tests" # uses: julia-actions/julia-runtest@master diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5ef155485..a6f089257 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - julia_version: ['1.6'] + julia_version: ['1.6', '1.7'] os: [ubuntu-latest] steps: - uses: actions/checkout@v2 diff --git a/src/categorical_algebra/CatElements.jl b/src/categorical_algebra/CatElements.jl index 648cef1f9..4783b0b6c 100644 --- a/src/categorical_algebra/CatElements.jl +++ b/src/categorical_algebra/CatElements.jl @@ -1,6 +1,8 @@ module CatElements export ThElements, AbstractElements, Elements, elements +using DataStructures: OrderedDict + using ..CSets, ..FinSets using ...Present, ...Theories using ...Theories: Category, ob, hom, dom_nums, codom_nums @@ -59,7 +61,7 @@ will be mapped to `src_E_1, tgt_E_1`. """ function presentation(X::AbstractElements) P = Presentation(FreeSchema) - obs = Dict{Tuple{Symbol, Int}, Any}() + obs = OrderedDict{Tuple{Symbol, Int}, Any}() for a in 1:nparts(X, :Ob) class = X[a, :nameo] for (i,j) in enumerate(incident(X, a, :πₑ)) @@ -68,7 +70,7 @@ function presentation(X::AbstractElements) end end add_generators!(P, values(obs)) - homs = Dict{Tuple{Symbol, Int}, Any}() + homs = OrderedDict{Tuple{Symbol, Int}, Any}() for f in 1:nparts(X, :Hom) class = X[f, :nameh] for (i,j) in enumerate(incident(X, f, :πₐ)) diff --git a/src/wiring_diagrams/Algebras.jl b/src/wiring_diagrams/Algebras.jl index 002fa09dc..530084cb6 100644 --- a/src/wiring_diagrams/Algebras.jl +++ b/src/wiring_diagrams/Algebras.jl @@ -22,9 +22,10 @@ box/junction attributes. The default attributes are those compatible with the function oapply(composite::UndirectedWiringDiagram, hom_map::AbstractDict, ob_map::Union{AbstractDict,Nothing}=nothing; hom_attr::Symbol=:name, ob_attr::Symbol=:variable) - homs = [ hom_map[name] for name in subpart(composite, hom_attr) ] + # XXX: Julia should be inferring these vector eltypes but isn't on v1.7. + homs = valtype(hom_map)[ hom_map[name] for name in composite[hom_attr] ] obs = isnothing(ob_map) ? nothing : - [ ob_map[name] for name in subpart(composite, ob_attr) ] + valtype(ob_map)[ ob_map[name] for name in composite[ob_attr] ] oapply(composite, homs, obs) end @@ -99,7 +100,9 @@ function oapply(composite::UndirectedWiringDiagram, end end end - diagram[:ob₁] = map(L, junction_feet) + for (j, foot) in enumerate(junction_feet) + diagram[j, :ob₁] = L(foot) + end # Find, or if necessary create, an outgoing edge for each junction. The # existence of such edges is an assumption for colimits of bipartite diagrams. diff --git a/test/categorical_algebra/CatElements.jl b/test/categorical_algebra/CatElements.jl index fb287d3cf..e7ddf5fee 100644 --- a/test/categorical_algebra/CatElements.jl +++ b/test/categorical_algebra/CatElements.jl @@ -32,7 +32,7 @@ b = @acset Graph begin end ThBPG, obmap, hommap = CatElements.presentation(elements(b)) -@test Symbol.(generators(ThBPG)) == [:E_1, :V_1, :V_2, :tgt_E_1, :src_E_1] +@test Symbol.(generators(ThBPG)) == [:V_1, :V_2, :E_1, :src_E_1, :tgt_E_1] p₀ = @acset Graph begin @@ -43,7 +43,8 @@ p₀ = @acset Graph begin end ThPetri, obmap, hommap = CatElements.presentation(elements(p₀)) -@test Symbol.(generators(ThPetri)) == [:E_1, :E_2, :V_1, :V_2, :src_E_2, :tgt_E_1, :tgt_E_2, :src_E_1] +@test Symbol.(generators(ThPetri)) == + [:V_1, :V_2, :E_1, :E_2, :src_E_1, :src_E_2, :tgt_E_1, :tgt_E_2] @acset_type Petri(ThPetri)