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

add missing cases for find first (length =0, 1)

This commit is contained in:
kalmar 2017-07-05 16:16:47 +02:00
parent 613ec172bd
commit 5a9d4b4bb6

View File

@ -271,7 +271,16 @@ is_subsymbol(s::GSymbol, t::GSymbol) =
function findfirst(W::GWord, Z::GWord)
n = length(Z.symbols)
@assert n > 1
if n == 0
return 0
elseif n == 1
for (i,s) in enumerate(W.symbols)
if is_subsymbol(Z.symbols[1], s)
return i
end
end
return 0
else
for (idx,a) in enumerate(W.symbols)
if idx + n - 1 > length(W.symbols)
break
@ -285,6 +294,8 @@ function findfirst(W::GWord, Z::GWord)
end
end
end
end
return 0
end