In another stack overflow question, the answer included the following function:
julia> function nzcols(b::SubArray{T,2,P,Tuple{UnitRange{Int64},UnitRange{Int64}}}) where {T,P<:SparseMatrixCSC} return collect(i+1-start(b.indexes[2]) for i in b.indexes[2] if b.parent.colptr[i]<b.parent.colptr[i+1] && inrange(b.parent.rowval[nzrange(b.parent,i)],b.indexes[1])) end nzcols (generic function with 3 methods)
And he was analyzed without errors. When adding a new line, an error appeared before the where clause for readability:
julia> function nzcols(b::SubArray{T,2,P,Tuple{UnitRange{Int64},UnitRange{Int64}}}) where {T,P<:SparseMatrixCSC} return collect(i+1-start(b.indexes[2]) for i in b.indexes[2] if b.parent.colptr[i]<b.parent.colptr[i+1] && inrange(b.parent.rowval[nzrange(b.parent,i)],b.indexes[1])) end ERROR: syntax: space before "{" not allowed in "where {"
Finally, when the parameter list bracket moves to the where line, the error disappears again:
julia> function nzcols(b::SubArray{T,2,P,Tuple{UnitRange{Int64},UnitRange{Int64}}} ) where {T,P<:SparseMatrixCSC} return collect(i+1-start(b.indexes[2]) for i in b.indexes[2] if b.parent.colptr[i]<b.parent.colptr[i+1] && inrange(b.parent.rowval[nzrange(b.parent,i)],b.indexes[1])) end nzcols (generic function with 3 methods)
What is the logic of this syntax and should it be fixed?
julia-lang
Dan getz
source share