Task

Using two Arrays of equal length, create a Hash object
where the elements from one array (the keys) are linked
to the elements of the other (the values)



Related task

   Associative arrays/Creation


with javascript_semantics
function make_hash(sequence keyarray, sequence valuearray)
    integer dict = new_dict()
    for i=1 to length(keyarray) do
        setd(keyarray[i],valuearray[i],dict)
--      setd(keyarray[i],i,dict)
    end for
    return dict
end function
 
constant keyarray   = {1,"two",PI}
constant valuearray = {"one",2,PI}
integer dict = make_hash(keyarray,valuearray)
?getd(1,dict)
?getd("two",dict)
?getd(PI,dict)
--?valuearray[getd(1,dict)]
