mirror of
https://github.com/kalmarek/Groups.jl.git
synced 2024-12-26 02:20:30 +01:00
add missing constructors and converts
This commit is contained in:
parent
f8aedc207f
commit
12be3b75bc
@ -18,3 +18,4 @@ function (==)(s::GSymbol, t::GSymbol)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Base.convert(::Type{GS}, s::GSymbol) where GS<:GSymbol = GS(s.id, s.pow)
|
Base.convert(::Type{GS}, s::GSymbol) where GS<:GSymbol = GS(s.id, s.pow)
|
||||||
|
Base.convert(::Type{GS}, s::GS) where GS<:GSymbol = s
|
||||||
|
@ -34,7 +34,10 @@ mutable struct GroupWord{T} <: GWord{T}
|
|||||||
savedhash::UInt
|
savedhash::UInt
|
||||||
parent::Group
|
parent::Group
|
||||||
|
|
||||||
function GroupWord{T}(symbols::Vector{<:GSymbol}) where T
|
function GroupWord{T}(symbols::AbstractVector{<:GSymbol}) where T
|
||||||
return new{T}(symbols, true, zero(UInt))
|
return new{T}(symbols, true, zero(UInt))
|
||||||
end
|
end
|
||||||
|
GroupWord(v::AbstractVector{T}) where T<:GSymbol = GroupWord{T}(v)
|
||||||
|
GroupWord{T}(s::GSymbol) where T<:GSymbol = GroupWord{T}(T[s])
|
||||||
|
GroupWord(s::T) where T<:GSymbol = GroupWord{T}(s)
|
||||||
end
|
end
|
||||||
|
@ -37,3 +37,5 @@ Base.@propagate_inbounds function Base.getindex(w::GWord, i::Integer)
|
|||||||
end
|
end
|
||||||
|
|
||||||
# no setindex! for syllable based words
|
# no setindex! for syllable based words
|
||||||
|
|
||||||
|
Base.convert(::Type{GW}, s::GSymbol) where GW <: GWord = GW(s)
|
||||||
|
Loading…
Reference in New Issue
Block a user