パスワードを忘れた? アカウント作成
12970477 journal
アップグレード

t-nissieの日記: 【電脳】Juliaのtypeof(x → x[1])

日記 by t-nissie

ありがたいことに、どこかの誰かがどこかのバグを直してくれたのか、
Pkg.update("Winston")したらWinstonがJulia-0.5で動くようになった。

WARNING: Base.FS is deprecated, use Base.Filesystem instead.

って警告は、$HOME/.julia/v0.5/Winston/src/Winston.jl を

diff --git a/src/Winston.jl b/src/Winston.jl
index ecfaaa6..8f7b5ee 100644
--- a/src/Winston.jl
+++ b/src/Winston.jl
@@ -1868,7 +1868,7 @@ function savesvg(p::PlotContainer, io::IO, width, height)
  end
 
  function savesvg(p::PlotContainer, filename::AbstractString, width, height)
-    io = Base.FS.open(filename, Base.JL_O_CREAT|Base.JL_O_TRUNC|Base.JL_O_WRONLY, 0o644)
+    io = Base.FileSystem.open(filename, Base.JL_O_CREAT|Base.JL_O_TRUNC|Base.JL_O_WRONLY, 0o644)
     savesvg(p, io, width, height)
     close(io)
     nothing

と直せば、抑制できる。

だがしかーし、

Julia-0.4.6:

julia> VERSION
v"0.4.6"
 
julia> typeof(x -> x[1])
Function

Julia-0.5:

julia> VERSION
v"0.5.0"
 
julia> typeof(x -> x[1])
##1#2

これはバグなのか新しい仕様なのか。

追記:
仕様みたい→Julia言語の0.5の変更点
こんなかんじで困っている:

julia> VERSION
v"0.5.0"
 
julia> function g(f::Array{Function,1})
           x = [1,2,3]
           map(f_each -> f_each(x), f)
       end
g (generic function with 1 method)
 
julia> g([x -> 1x[1], x -> 2x[2], x -> 3x[3]])
3-element Array{Int64,1}:
  1
  4
  9
 
julia> g([x -> 1x[1], x -> 2x[2]])
2-element Array{Int64,1}:
  1
  4
 
julia> g([x -> 1x[1]])
ERROR: MethodError: no method matching g(::Array{##13#14,1})
Closest candidates are:
  g(::Array{Function,1}) at REPL[1]:2

function g(f::Array{Function,1})と引数の型を指定しないで、ただ
function g(f)と書けば動くけど。

この議論は賞味期限が切れたので、アーカイブ化されています。 新たにコメントを付けることはできません。
typodupeerror

海軍に入るくらいなら海賊になった方がいい -- Steven Paul Jobs

読み込み中...