Echows
Echows

Reputation: 317

How do I use the dot syntax in Julia function calls

According to Julia documentation, I should be able to call a given (even non-vectorized) function for every element in an array using fun.(A), where A is an array. I try with a simple example and it doesn't seem to work:

julia> x = collect(linspace(0,pi,100));
julia> y = sin.(x)
ERROR: TypeError: getfield: expected Symbol, got Array{Float64,1}

The same error persists with all my own functions. How do I use this feature correctly?

Upvotes: 3

Views: 1678

Answers (1)

StefanKarpinski
StefanKarpinski

Reputation: 33249

Just to give this an official answer, this is a new feature that was introduced in Julia 0.5, while @Echows was using Julia 0.4. The solution is to upgrade to Julia 0.5 or newer.

Upvotes: 8

Related Questions