Thanks!

Does it mean that now curly braces { } are not used anymore in the version 
0.4?


On Friday, September 11, 2015 at 5:53:19 PM UTC+2, Yichao Yu wrote:
>
> On Fri, Sep 11, 2015 at 11:39 AM, Alex M <[email protected] <javascript:>> 
> wrote: 
> > Hello, 
> > I am learning Julia. 
> > 
> > Both are arrays but of different types: 
> > 
> > julia> {} 
> > 0-element Array{Any,1} 
> > 
> > julia> [] 
> > 0-element Array{None,1} 
> > 
> > 
> > julia> [] == {} 
> > true 
> > 
> > Now I am trying to push new data : 
> > 
> > 
> > julia> a = [] 
> > julia> b = {} 
> > 
> > 
> > julia> push!(a,"y") 
> > ERROR: [] cannot grow. Instead, initialize the array with "T[]", where T 
> is 
> > the desired element type. 
> >  in push! at array.jl:457 (repeats 2 times) 
> > 
> > 
> > But for [] it works: 
> > 
> > julia> push!(b,"y") 
> > 1-element Array{Any,1}: 
> >  "y" 
> > 
> > 
> > Also using {} I can create Dictionary: 
> > 
> > julia> {"a" => 3} 
> > Dict{Any,Any} with 1 entry: 
> >   "a" => 3 
> > 
> > 
> > Now I am very confused. 
> > 
> > 1) What is the meaning of { } ? is it a dictionary constructor or an 
> array 
> > constructor of type Any ? 
>
> It was `Any[]` for 0.3. Deprecated for 0.4 
>
> > 2) Why can't I push into [ ] ? 
>
> Because the type is None. `[]` on 0.4 returns `Array{Any,1}` and that 
> isn't a problem anymore. 
>
> > 
> > Thank you in advance! 
>

Reply via email to