mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2025-01-12 06:12:33 +01:00
Sort keys in subst_dict by wordlength (in reverse)
This commit is contained in:
parent
aa9bba617a
commit
ebecf988ec
@ -223,8 +223,7 @@ function replace!(W::GWord, index, toreplace::GWord, replacement::GWord; asserts
|
||||
end
|
||||
|
||||
function replace_all!{T}(W::GWord{T}, subst_dict::Dict{GWord{T}, GWord{T}})
|
||||
reduced = true
|
||||
for toreplace in reverse!(sort!(collect(keys(subst_dict))))
|
||||
for toreplace in reverse!(sort!(collect(keys(subst_dict)),by=length))
|
||||
replacement = subst_dict[toreplace]
|
||||
i = findfirst(W, toreplace)
|
||||
while i ≠ 0
|
||||
|
Loading…
Reference in New Issue
Block a user