diff --git a/Project.toml b/Project.toml index 72f9cf29..8803b7f6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "KnuthBendix" uuid = "c2604015-7b3d-4a30-8a26-9074551ec60a" authors = ["Marek Kaluba ", "Mikołaj Pabiszczak "] -version = "0.2.0" +version = "0.2.1" [deps] MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" diff --git a/src/alphabets.jl b/src/alphabets.jl index fa721cef..395e4ab9 100644 --- a/src/alphabets.jl +++ b/src/alphabets.jl @@ -220,7 +220,7 @@ Base.inv(A::Alphabet{T}, a::T) where {T} = A[-A[a]] function _print_syllable(io, symbol, pow) str = string(symbol) if length(str) > 3 && endswith(str, "^-1") - print(io, str[1:end-3], "^-", pow) + print(io, first(str, length(str)-3), "^-", pow) else if pow == 1 print(io, str) diff --git a/test/alphabets.jl b/test/alphabets.jl index 2d2fbfd6..724ca419 100644 --- a/test/alphabets.jl +++ b/test/alphabets.jl @@ -47,6 +47,10 @@ @test sprint(show, MIME"text/plain"(), A) isa String @test A[A[1]] == 1 + + A = Alphabet(["a₁", "a₁^-1"], [2, 1]) + w = Word([1,2,2]) + @test sprint(KnuthBendix.print_repr, w, A) == "a₁*a₁^-2" end @testset "Inverting using Alphabet" begin