- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Stack Overflow 上的另一个问题中,答案包括以下函数:
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)
where
之前添加换行符时为了可读性的条款,突然出现一个错误:
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 {"
where
行,错误再次消失:
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)
最佳答案
这类似于该语言中的许多其他语法;如果解析器在一行的末尾有一个“完整”的语法,它将使用它并继续。
julia> parse("begin; 1 \n+ 2; end")
quote # none, line 1:
1 # none, line 2:
+2
end
julia> parse("begin; 1 +\n 2; end")
quote # none, line 1:
1 + 2
end
where
子句放到一个单独的行,但
where
本身需要与函数的结尾在同一行。
关于julia - 为什么 Julia 中的 `where` 语法对换行敏感?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43983787/
我这里有一些(遗留)代码,似乎在LD_LIBRARY_PATH上调用setenv(其值在编译时未知,实际上它将从命令中获取)行),现在我必须将其移植到 Windows。我怀疑 setenv 只是出于历
我在 SSIS 包上有一个敏感字符串参数,用于存储远程服务器的密码。 但是,当字符串值包含花括号时,作业代理会在配置该步骤的包参数时抛出错误: Microsoft SQL Server Managem
我们都非常了解 strictfp 的工作原理。 像这样: package com.hk.basicjava.tests.strictfp; import java.util.*; public cla
我正在对我的博客进行简单搜索。我使用亚美尼亚语,当我搜索时,这些字母总是很敏感。这是我的代码的一部分。提前谢谢你。 search_query = get.get('search') query_lis
我正在对我的博客进行简单搜索。我使用亚美尼亚语,当我搜索时,这些字母总是很敏感。这是我的代码的一部分。提前谢谢你。 search_query = get.get('search') query_lis
想象一下这个非常基本的可拖放设置: #dropArea 是可放置的。 #itemBox > .item 是可拖动对象。 由于某种原因,droppable
我有这样的网址: http://quickstart.local/public/category1/product2 并且在 url (category1/product2) 数字是 id ,从数据库
我是一名优秀的程序员,十分优秀!