From 4718c40bd1c4e92b87dd3c4fb1da4761412b6286 Mon Sep 17 00:00:00 2001 From: kalmar Date: Thu, 11 May 2017 18:00:46 +0200 Subject: [PATCH] move hash --- src/Groups.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Groups.jl b/src/Groups.jl index 8ab302d..cb0cb67 100644 --- a/src/Groups.jl +++ b/src/Groups.jl @@ -54,6 +54,10 @@ convert{T<:GSymbol, W<:Word}(::Type{W}, s::T) = GWord{T}(s) +function hash(W::GWord, h::UInt) + W.modified && reduce!(W) + return W.savedhash $ h +end end length(W::GWord) = sum([length(s) for s in W.symbols]) @@ -89,10 +93,6 @@ end reduce(W::GWord) = reduce!(deepcopy(W)) -function hash{T}(W::GWord{T}, h::UInt) - W.modified && reduce!(W) - return W.savedhash + h -end function (==){T}(W::GWord{T}, Z::GWord{T}) W.modified && reduce!(W) # reduce clears the flag and recalculate the hash