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


link ximage    # to format the structure
 
procedure main(arglist)                          #: demonstrate hash from 2 lists
local keylist 
 
if *arglist = 0 then arglist := [1,2,3,4]        # ensure there's a list
every put(keylist := [], "key-" || !arglist)     # make keys for each entry
 
every  (T := table())[keylist[ i := 1 to *keylist ]] := arglist[i]  # create the hash table
 
write(ximage(T))                                 # show result
end