【发布时间】:2018-08-05 00:00:54
【问题描述】:
用一个简单的函数比如
function fun(x::Real, y::Real)
x, y
end
我想通过这样做使用 pmap() 调用
pmap(fun, [x for x=0:.1:2], [y for y=4:-.1:2])
Julia 给出了这个错误
ERROR: LoadError: MethodError: Cannot `convert` an object of type Tuple{Float64,Float64} to an object of type AbstractFloat
This may have arisen from a call to the constructor AbstractFloat(...),
since type constructors fall back to convert methods.
我真的不明白这里发生了什么。
根据我所做的一些研究:
It's well-established that to call map on an N-argument function, you pass N lists (or whatever collection) to map:
julia> map(+, (1,2), (3,4))
(4,6)
那怎么了?
【问题讨论】: