diff --git a/src/AbstractAlgebra.jl b/src/AbstractAlgebra.jl index f72725c5e8..254ab9331b 100644 --- a/src/AbstractAlgebra.jl +++ b/src/AbstractAlgebra.jl @@ -366,12 +366,16 @@ include("KnownProperties.jl") ############################################################################### # -# Syntax S[i] for all parents S as a shortcut for gen(S, i) +# getindex methods # ################################################################################ +# Syntax S[i] for all parents S as a shortcut for gen(S, i) getindex(S::Set, i::Int) = gen(S, i) +# Syntax S[i1, i2, ...] for a vector +getindex(S::Set, i...) = [S(ix) for ix in i] + ############################################################################### # # Load error objects @@ -392,7 +396,6 @@ include("broadcasting.jl") include("Deprecations.jl") - ############################################################################### # # Set domain for ZZ, QQ @@ -470,6 +473,7 @@ end # Utils # ############################################################################### + include("utils.jl") ############################################################################### diff --git a/src/fundamental_interface.jl b/src/fundamental_interface.jl index 5c82740e74..1d4a43804d 100644 --- a/src/fundamental_interface.jl +++ b/src/fundamental_interface.jl @@ -1,6 +1,6 @@ ############################################################################### # -# basic_interface.jl : basic interface for AbstractAlgebra +# fundamental_interface.jl : fundamental interface for AbstractAlgebra # ############################################################################### diff --git a/test/AbstractAlgebra-test.jl b/test/AbstractAlgebra-test.jl index 8da7199e21..fc02572092 100644 --- a/test/AbstractAlgebra-test.jl +++ b/test/AbstractAlgebra-test.jl @@ -1,3 +1,10 @@ +@testset "getindex" begin + Zxy, (x, y) = ZZ[:x, :y] + v = Zxy[x^3, 3 * x^2 * y + 1, -3, ZZ(12)] + + @test v == [x^3, 3 * x^2 * y + 1, Zxy(-3), Zxy(12)] +end + include("error-test.jl") include("AliasMacro-test.jl") include("Attributes-test.jl")