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


class ZIPPER{K,E} is
  zip(k:ARRAY{K}, e:ARRAY{E}) :MAP{K, E} 
    pre k.size = e.size
  is
    m :MAP{K, E} := #;
    loop m[k.elt!] := e.elt!; end;
    return m;    
  end;
end;
 
class MAIN is
 
  main is
    keys:ARRAY{STR} := |"one", "three", "four"|;
    values:ARRAY{INT} := |1, 3, 4|;
    m ::= ZIPPER{STR,INT}::zip(keys, values);
    loop 
      #OUT + m.pair! + " "; 
    end;
    #OUT + "\n";
  end;
 
end;