I’m trying to broadcast a function call over a vector of functions, but call.(f,0.1)
is deprecated. I tried f.(0.1)
but it doesn’t work:
julia> f=[x->x,x->x^2]
2-element Array{Function,1}:
#5
#6
julia> f.(0.1)
ERROR: MethodError: objects of type Array{Function,1} are not callable
Use square brackets [] for indexing an Array.
in broadcast(::Array{Function,1}, ::Float64) at ./broadcast.jl:16
julia> call.(f,0.1)
WARNING: call(f,args...) is deprecated, use f(args...) instead.
in depwarn(::String, ::Symbol) at ./deprecated.jl:64
in ##1003#1004(::Array{Any,1}, ::Function, ::Function, ::Float64, ::Vararg{Float64,N}) at ./deprecated.jl:272
in (::Base.##1003#1005)(::Function, ::Float64, ::Vararg{Float64,N}) at ./deprecated.jl:271
in broadcast_t(::Function, ::Type{Any}, ::Array{Function,1}, ::Vararg{Any,N}) at ./broadcast.jl:222
in broadcast(::Function, ::Array{Function,1}, ::Float64) at ./broadcast.jl:230
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /Users/solver/Projects/julia/usr/lib/julia/sys.dylib:?
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
in macro expansion at ./REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
while loading no file, in expression starting on line 0
WARNING: call(f,args...) is deprecated, use f(args...) instead.
in depwarn(::String, ::Symbol) at ./deprecated.jl:64
in ##1003#1004(::Array{Any,1}, ::Function, ::Function, ::Float64, ::Vararg{Float64,N}) at ./deprecated.jl:272
in macro expansion at ./broadcast.jl:192 [inlined]
in _broadcast!(::Base.##1003#1005, ::Array{Float64,1}, ::Tuple{Tuple{Bool},Tuple{}}, ::Tuple{Tuple{Int64},Tuple{}}, ::Tuple{Array{Function,1},Float64}, ::Type{Val{2}}, ::CartesianRange{CartesianIndex{1}}, ::CartesianIndex{1}, ::Int64) at ./broadcast.jl:179
in broadcast_t(::Function, ::Type{Any}, ::Array{Function,1}, ::Vararg{Any,N}) at ./broadcast.jl:225
in broadcast(::Function, ::Array{Function,1}, ::Float64) at ./broadcast.jl:230
in eval(::Module, ::Any) at ./boot.jl:234
in eval(::Module, ::Any) at /Users/solver/Projects/julia/usr/lib/julia/sys.dylib:?
in eval_user_input(::Any, ::Base.REPL.REPLBackend) at ./REPL.jl:64
in macro expansion at ./REPL.jl:95 [inlined]
in (::Base.REPL.##3#4{Base.REPL.REPLBackend})() at ./event.jl:68
while loading no file, in expression starting on line 0
2-element Array{Float64,1}:
0.1
0.01