Hello,

Is there a way to quickly build a hash from the values of an array?

A one-statement equivalent of:
  T[] array_values ;
  int[T] hash_values;

  hash_values = map!(XXXX) (array_values) ;

Instead of:
  for (v; array_values) {
     hash_values[v] = 1;
  }


in Perl, that would be:

  %hash = map { $_ => 1 } @array;

---

Or, put differently, is there a way to convert values in an array to keys of hash in one statement ?

Thanks!
 -gordon

Reply via email to