Skip to content

Commit

Permalink
simplify star(w::Word) in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kalmarek committed Feb 14, 2024
1 parent a5f46e8 commit a1325f8
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions test/test_example_words.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,13 @@ function Base.:*(w::Word, z::Word)
end

function StarAlgebras.star(w::Word)
newletters = similar(w.letters)

# star(:a) = :b
# star(:b) = :a
# star(:c) = :c

star_d = Dict(1 => 2, 2 => 1)

for (i, l) in enumerate(Iterators.reverse(w.letters))
k = haskey(star_d, l) ? star_d[l] : l
newletters[i] = k
end
newletters = [get(star_d, l, l) for l in Iterators.reverse(w.letters)]
return Word(w.alphabet, newletters)
end

Expand Down

0 comments on commit a1325f8

Please sign in to comment.