I have successfully defined a custom array Ngram. type Ngram <: AbstractArray{ASCIIString,1} seq::ASCIIString n::Int end
function getindex(s::Ngram, i::Int) s.seq[i:i+s.n-1] end function Base.size(s::Ngram) length(s.seq) - s.n + 1 end It works as I expected. For example In [219]: ng=SeqUtil.Ngram("hello",2) Out[219]: 4-element Ngram: "he" "el" "ll" "lo" But it seems in other usage, a corresponding `similar` method is necessary In [222]: map(print,ng) he `similar` has no method matching similar(::Ngram, ::Type{Nothing}, ::(Int32,)) while loading In[222], in expression starting on line 1 in similar at abstractarray.jl:116 in map at abstractarray.jl:1329 I have read the documentation and I still don't get what I need to do in the similar method. You help will be appreciated. Wai Yip