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

accomodate to abstract GWord{T}

This commit is contained in:
kalmarek 2018-03-27 21:48:36 +02:00
parent fc879f068b
commit 17958fbd2c

View File

@ -356,7 +356,7 @@ function replace(W::GWord, index, toreplace::GWord, replacement::GWord)
replace!(deepcopy(W), index, toreplace, replacement)
end
function replace_all!(W::GWord{T},subst_dict::Dict{GWord{T},GWord{T}}) where {T}
function replace_all!(W::T,subst_dict::Dict{T,T}) where {T<:GWord}
modified = false
for toreplace in reverse!(sort!(collect(keys(subst_dict)), by=length))
replacement = subst_dict[toreplace]
@ -370,7 +370,7 @@ function replace_all!(W::GWord{T},subst_dict::Dict{GWord{T},GWord{T}}) where {T}
return modified
end
function replace_all(W::GWord{T},subst_dict::Dict{GWord{T},GWord{T}}) where {T}
function replace_all(W::T, subst_dict::Dict{T,T}) where {T<:GWord}
W = deepcopy(W)
replace_all!(W, subst_dict)
return W