1
0
mirror of https://github.com/kalmarek/Groups.jl.git synced 2024-12-05 02:11:27 +01:00

use append! and prepend! instead of push! and unshift!

This also fixes a bug in l_multiply!
This commit is contained in:
kalmarek 2018-03-21 19:21:03 +01:00
parent 181073b517
commit 49198dfdf4

View File

@ -192,7 +192,7 @@ end
function r_multiply!(W::GWord, x; reduced::Bool=true) function r_multiply!(W::GWord, x; reduced::Bool=true)
if length(x) > 0 if length(x) > 0
push!(W.symbols, x...) append!(W.symbols, x)
end end
if reduced if reduced
reduce!(W) reduce!(W)
@ -200,9 +200,9 @@ function r_multiply!(W::GWord, x; reduced::Bool=true)
return W return W
end end
function l_multiply!(W::GWord, x; reduced=true) function l_multiply!(W::GWord, x; reduced::Bool=true)
if length(x) > 0 if length(x) > 0
unshift!(W.symbols, reverse(x)...) prepend!(W.symbols, x)
end end
if reduced if reduced
reduce!(W) reduce!(W)