1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-11-19 06:30:29 +01:00

GWord is never equal to GSymbol as == requires parent

This commit is contained in:
kalmar 2017-05-11 18:05:03 +02:00
parent 9b48932ab4
commit d3adfdb8b6

View File

@ -109,14 +109,7 @@ doc"""
"""
reduce(W::GWord) = reduce!(deepcopy(W))
function (==){T}(W::GWord{T}, Z::GWord{T})
W.modified && reduce!(W) # reduce clears the flag and recalculate the hash
Z.modified && reduce!(Z)
return W.savedhash == Z.savedhash && W.symbols == Z.symbols
end
(==){T}(W::GWord{T}, s::T) = W == GWord(s)
(==){T}(s::T, W::GWord{T}) = W == GWord(s)
function show(io::IO, W::GWord)
if length(W) == 0
@ -126,6 +119,13 @@ function show(io::IO, W::GWord)
end
end
function (==)(W::GWord, Z::GWord)
parent(W) == parent(Z) || return false
W.modified && reduce!(W) # reduce clears the flag and calculates savedhash
Z.modified && reduce!(Z)
return W.savedhash == Z.savedhash && W.symbols == Z.symbols
end
function r_multiply!(W::GWord, x; reduced::Bool=true)
if length(x) > 0
push!(W.symbols, x...)