稳定的docs广播示例失败

时间:2017-08-14 23:47:07

标签: julia

the arrays section of the manual中有一个在字符串上使用隐式广播的示例,这对我来说是失败的。我可以解决它,但我只是想报告它 -

julia> string.(1:3, ". ", ["First", "Second", "Third"])

我得到以下输出 -

ERROR: MethodError: no method matching size(::String)
Closest candidates are:
  size{N}(::Any, ::Integer, ::Integer, ::Integer...) at abstractarray.jl:48
  size(::BitArray{1}) at bitarray.jl:39
  size(::BitArray{1}, ::Any) at bitarray.jl:43
  ...
 in map(::Base.#indices, ::Tuple{String,Array{String,1}}) at 
./tuple.jl:93
 in broadcast_shape(::UnitRange{Int64}, ::String, ::Array{String,1}, 
::Vararg{Array{String,1},N}) at ./broadcast.jl:31
 in broadcast_t(::Function, ::Type{T}, ::UnitRange{Int64}, 
::Vararg{Any,N}) at ./broadcast.jl:228
 in broadcast(::Function, ::UnitRange{Int64}, ::String, 
::Array{String,1}) at ./broadcast.jl:230

1 个答案:

答案 0 :(得分:1)

这只是一个版本问题。在v0.5上它不起作用,从v0.6开始。

文档也有适当的版本:

version 0.5 Array broadcasting docs

version 0.6 Array broadcasting docs

所以一切都很好。