Just another update

This commit is contained in:
Ingy döt Net 2015-02-20 00:35:01 -05:00
parent a25938f123
commit 00a190b0a6
6591 changed files with 94363 additions and 23227 deletions

View file

@ -0,0 +1,27 @@
julia> hash = {'a' => 97, 'b' => 98} # list keys/values
{'a'=>97,'b'=>98}
julia> hash = {c => int(c) for c = 'a':'d'} # dict comprehension
{'a'=>97,'c'=>99,'b'=>98,'d'=>100}
julia> hash['é'] = 233 ; hash # add an element
{'a'=>97,'c'=>99,'b'=>98,'é'=>233,'d'=>100}
julia> hash = Dict() # create an empty dict
Dict{Any,Any}()
julia> for c = 'a':'d' hash[c] = int(c) end ; hash # fill it
{'a'=>97,'c'=>99,'b'=>98,'d'=>100}
julia> hash = (Char=>Int64)['a' => 97, 'b' => 98] # create a typed dict
['a'=>97,'b'=>98]
julia> hash["a"] = 1 # type mismatch
ERROR: no method convert(Type{Char}, ASCIIString)
in setindex! at dict.jl:533
julia> hash = Dict(['a','b','c'], [97,98,99]) # constructor
['a'=>97,'c'=>99,'b'=>98]
julia> typeof(hash) # type is infered correctly
Dict{Char,Int64} (constructor with 3 methods