BioSequences.jl icon indicating copy to clipboard operation
BioSequences.jl copied to clipboard

`Base.eltype(::Type{<:Alphabet})` violates `eltype` docstring

Open jakobnissen opened this issue 3 years ago • 2 comments

It states it gives the type of elements generated when iterating over the collection. But alphabets are not iterable. Not sure how to fix this. I certainly don't want to break the shiny new interface of BioSequences. Maybe just add Base.iterate(x::Alphabet, state...) = iterate(symbols(x), state...)?

jakobnissen avatar Jun 09 '22 11:06 jakobnissen

Yes I've been thinking that Alphabet's should in a way, behave like a lazy container/set of all the symbols they permit, so Base.iterate(x::Alphabet, state...) = iterate(symbols(x), state...), or (symbols(x::Alphabet) = collect(x) - chicken or egg? ^.^ ) Make sense to me.

TransGirlCodes avatar Jun 09 '22 12:06 TransGirlCodes

I think the idea of an Alphabet being a set is correct and offers some useful constructs. For example, It would be nice to be able to do issubset(symbols, alphabet).

CiaranOMara avatar Jun 13 '22 02:06 CiaranOMara