Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
|
|
@ -0,0 +1,5 @@
|
|||
local :h_keys [ :one :two :three ]
|
||||
local :h_values [ 1 2 3 ]
|
||||
local :h {}
|
||||
for item in h_keys:
|
||||
set-to h item pop-from h_values
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
def keys = ['a','b','c']
|
||||
def vals = ['aaa', 'bbb', 'ccc']
|
||||
def hash = [:]
|
||||
keys.eachWithIndex { key, i ->
|
||||
hash[key] = vals[i]
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
List.metaClass.hash = { list -> [delegate, list].transpose().collectEntries { [(it[0]): it[1]] } }
|
||||
|
|
@ -0,0 +1 @@
|
|||
assert (['a', 'b', 'c'].hash(['aaa', 'bbb', 'ccc'])) == [a: 'aaa', b: 'bbb', c: 'ccc']
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
keys = ['a','b','c']
|
||||
vals = ['aaa', 'bbb', 'ccc']
|
||||
hash = [:]
|
||||
keys.eachWithIndex { key, i ->
|
||||
hash[key] = vals[i]
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
julia> K = ["a", "b", "c"]
|
||||
julia> V = [1, 2, 3]
|
||||
julia> H = [key => value for (key, value) in zip(K,V)]
|
||||
{"b"=>2,"c"=>3,"a"=>1}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
julia> H = (String=>Int)[key => value for (key, value) in zip(K,V)]
|
||||
["b"=>2,"c"=>3,"a"=>1]
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
julia> H = Dict(K, V)
|
||||
["b"=>2,"c"=>3,"a"=>1]
|
||||
Loading…
Add table
Add a link
Reference in a new issue