Yes, this is a bug: ranges should behave as vectors in read-only
situations.  I suspect that this is on the radar of the devs already as
there is quite a bit of work happening in this area.  But still filing a
bug report, if one does not exist yet, is probably the right thing to do.

On Wed, 2016-06-01 at 03:26, Anonymous <espr...@gmail.com> wrote:
> Consider the code:
>
> filter(n -> true, collect(1:0))
>
> this returns a 0-element array.  However if I don't collect the iterator
> into an array:
>
> filter(n -> true, 1:0)
>
> I get the error
>
> Error: TypeError: typeassert: expected AbstractArray{Bool, N}, got
> Array{Int64, 1} in filter at array.jl:923
>
> It seems like this should also return a 0-element array, since if the
> iterator is non empty, e.g.
>
> filter(n -> true, 1:2)
>
> I get a two the element array [1,2].

Reply via email to