I should have said SubString
.
Since you have this:
julia> collect(Iterators.partition(1:5, 2))
3-element Vector{UnitRange{Int64}}:
1:2
3:4
5:5
and
julia> collect(Iterators.partition([1,2,3,4,5], 2))
3-element Vector{SubArray{Int64, 1, Vector{Int64}, Tuple{UnitRange{Int64}}, true}}:
[1, 2]
[3, 4]
[5]
why can’t a partition
over String
return a Substring
? A SubString
is to a String
as a SubArray
is to an Array
, isn’t it?
The docstring of partition
just says
Iterate over a collection n elements at a time.
which is vague enough as far as I can tell.