This doesn't directly address your issue (which seems valid and simple to 
me) but you can use fill(0, 5) or fill( int64(0), 5) to create a vector 
with initialized values.  


On Wednesday, February 4, 2015 at 4:00:51 AM UTC-6, Kristoffer Carlsson 
wrote:
>
> If you want to allocate an Array you can simply write:
>
> julia> Array(Int, 5, 1)
> 10x1 Array{Int64,2}:
>  2187293504
>  2151034912
>  2195818528
>  2147516504
>
> Now, Vector is a short form for Array{T, 1}. I would then expect to be 
> able to allocate a vector using something like this:
>
> julia> Vector(Int, 5)
> ERROR: MethodError: `convert` has no method matching convert(::Type{Array{
> T,1}},
>  ::Type{Int64}, ::Int64)
> This may have arisen from a call to the constructor Array{T,1}(...), 
> since type
> constructors fall back to convert methods in julia v0.4.
> Closest candidates are:
>   convert{T}(::Type{Nullable{T}}, ::T)
>   convert{T}(::Type{T}, ::T)
>   convert{T}(::Type{FloatRange{T}}, ::FloatRange{T<:FloatingPoint})
>   ...
>
> Could someone help me with the syntax? Do you have to use the Array form 
> every time you want to initiate a Arrat{T,1} with a certain length?
>
> Best regards,
> Kristoffer Carlsson
>

Reply via email to