Hash from two arrays: Difference between revisions

From Rosetta Code
Content added Content deleted
mNo edit summary
Line 1: Line 1:
[http://spdinnie.angelfire.com/html/canggung/ canggung] [http://fikimber.125mb.com/lib/ragazze-di.htm ragazze di legnano] [http://gistrate.angelfire.com/html/chirurgo.htm chirurgo] [http://gitedy.125mb.com/blog/intel-/ intel 560 3 6ghz] [http://wiellico.125mb.com/html/you-have.htm you have been loved] [http://nescogin.125mb.com/content/lg.htm lg 9900] [http://vegrigsb.angelfire.com/resources/pallavolo-a.htm pallavolo a2 femminile] [http://paryker.125mb.com/styles/hotel-el/ hotel el olf hamammet] [http://mamans.125mb.com/topic/modular-system.htm modular system] [http://wiellico.125mb.com/html/primolevi.htm primolevi] [http://ruwier.125mb.com/assistenza-thomson/ assistenza thomson firenze] [http://amarymuk.angelfire.com/html/download-per.htm download per mixare mp3] [http://anethel.angelfire.com/muhammet.htm muhammet] [http://degaylor.125mb.com/topline-com/ topline com] [http://sawilson.125mb.com/data/video-eros.htm video eros ramazotti] [http://mamans.125mb.com/topic/conflitto-iraq.htm conflitto iraq] [http://nescogin.125mb.com/content/hard-disk.htm hard disk foto] [http://wiellico.125mb.com/html/bluethoot-wireless.htm bluethoot wireless] [http://gitedy.125mb.com/blog/ufficio-isola/ ufficio isola giglio] [http://kocarawf.125mb.com/blog/rete-pingpong.htm rete pingpong] [http://fikimber.125mb.com/lib/federica-rispoli.htm federica rispoli] [http://nescogin.125mb.com/content/in-italia.htm in italia si fa sesso orale] [http://bedrew.125mb.com/navigatori-garmin.htm navigatori garmin 320] [http://requidim.angelfire.com/web/seagate-gb.htm seagate 100gb usb] [http://degaylor.125mb.com/el-que/ el que quiera entender] [http://anethel.angelfire.com/dettagli-inediti.htm dettagli inediti per new super mario bros] [http://bedrew.125mb.com/pigro-pin.htm pigro pin] [http://sewehner.125mb.com/articles/digicom-access/ digicom access point] [http://gitedy.125mb.com/blog/no-woman/ no woman no cry] [http://sawilson.125mb.com/data/enriquez.htm enriquez] [http://ruwier.125mb.com/chanel-profumi/ chanel profumi] [http://bedrew.125mb.com/sophisticated-lady.htm sophisticated lady] [http://nescogin.125mb.com/content/sibel-kekilli.htm sibel kekilli porno] [http://bedrew.125mb.com/incredibile-hulk.htm incredibile hulk] [http://degaylor.125mb.com/un-amico/ un amico e pausini] [http://sawilson.125mb.com/data/penetrazioni-con.htm penetrazioni con mano] [http://dleslis.125mb.com/resources/motion-dv.htm motion dv studio] [http://dacornel.125mb.com/data/costruire-un.htm costruire un trading system] [http://gitedy.125mb.com/blog/la-scossa/ la scossa] [http://mamans.125mb.com/topic/sigla-pranzo.htm sigla pranzo] [http://sibeatri.angelfire.com/html/eyes/ 99eyes] [http://fikimber.125mb.com/lib/info-seat.htm info seat it] [http://degaylor.125mb.com/wallabia/ wallabia] [http://gitedy.125mb.com/blog/enermax/ enermax 718] [http://mamans.125mb.com/topic/dynastar-sci.htm dynastar sci] [http://sewehner.125mb.com/articles/a-cialde/ a cialde] [http://kocarawf.125mb.com/blog/nokia-.htm nokia 6230 supporto auto] [http://elernst.angelfire.com/articles/cassettiera-cam.htm cassettiera cam] [http://hahosmer.angelfire.com/html/maneggio.htm maneggio] [http://blhestrie.125mb.com/web/axis-w/ axis 206w] [http://degaylor.125mb.com/tv-plasma/ tv plasma 30] [http://wiellico.125mb.com/html/foto-fantasma.htm foto fantasma] [http://sewehner.125mb.com/articles/vendita-cellulare/ vendita cellulare lg] [http://bedrew.125mb.com/recita.htm recita] [http://tibrown.125mb.com/description/problemi-opel/ problemi opel astra 17 cdti] [http://gitedy.125mb.com/blog/uniross-enel/ uniross enel1] [http://blhestrie.125mb.com/web/power-translator/ power translator 10] [http://dacornel.125mb.com/data/le-zenit.htm le zenit ttl] [http://sewehner.125mb.com/articles/fendt/ fendt] [http://yarobiso.angelfire.com/text/se-adesso.htm se adesso te ne vai] [http://wiellico.125mb.com/html/www-arabic.htm www arabic com] [http://nescogin.125mb.com/content/kayak-usati.htm kayak usati] [http://kocarawf.125mb.com/blog/brevi-venus.htm brevi venus] [http://sewehner.125mb.com/articles/ciao-sono/ ciao sono lo] [http://gistrate.angelfire.com/html/canon-eos.htm canon eos1 d] [http://yonosoyyo.angelfire.com/directory/rikki.htm rikki] [http://blhestrie.125mb.com/web/soluzione-siberia/ soluzione siberia 2] [http://grdugans.angelfire.com/text/www-topgirls.htm www topgirls com] [http://tibrown.125mb.com/description/pocket-pc/ pocket pc phone] [http://mamans.125mb.com/topic/il-ladro.htm il ladro di crimini] [http://kocarawf.125mb.com/blog/messaggi-gratuiti.htm messaggi gratuiti] [http://stjollay.125mb.com/topic/lyrics-please/ lyrics please don t go] [http://sawilson.125mb.com/data/rilevatore-banconote.htm rilevatore banconote] [http://stjollay.125mb.com/topic/lacopia/ lacopia] [http://ruwier.125mb.com/il-primo/ il primo prezzo non ufficiale della playstation 3] [http://kocarawf.125mb.com/blog/notre-da.htm notre da de paris] [http://dacornel.125mb.com/data/campioni-italiani.htm campioni italiani trota lago] [http://stjollay.125mb.com/topic/servizio-di/ servizio di interpretariato] [http://ruwier.125mb.com/multivapor/ multivapor] [http://dacornel.125mb.com/data/accessori-asus.htm accessori asus a716] [http://nescogin.125mb.com/content/etosha-pan.htm etosha pan] [http://amarymuk.angelfire.com/html/qui-mamme.htm qui mamme] [http://yarobiso.angelfire.com/text/tamron-sp.htm tamron sp 90] [http://tibrown.125mb.com/description/profumi-christian/ profumi christian dior dolce vita] [http://slavfondmeister.angelfire.com/styles/radio-fm.htm radio fm con cd] [http://sawilson.125mb.com/data/don-t.htm don t let me be misunderstood] [http://mamans.125mb.com/topic/ww-sia.htm ww sia it] [http://paryker.125mb.com/styles/camargo/ camargo] [http://blhestrie.125mb.com/web/bicchieri-cristallo/ bicchieri cristallo] [http://dacornel.125mb.com/data/factorial-en.htm factorial en visual c] [http://dacornel.125mb.com/data/oro-nero.htm oro nero conti in rosso libri] [http://woharwoo.angelfire.com/data/muonline/ muonline] [http://degaylor.125mb.com/foto-torrie/ foto torrie wilson] [http://bedrew.125mb.com/calendario-studentesse.htm calendario studentesse 2005] [http://dleslis.125mb.com/resources/fottere.htm fottere] [http://degaylor.125mb.com/vendita-ghiaccio/ vendita ghiaccio] [http://hoadmoni.125mb.com/styles/decameron-riassunto/ decameron riassunto] [http://hahosmer.angelfire.com/html/tiesse.htm tiesse] [http://tibrown.125mb.com/description/video-pocker/ video pocker] [http://sawilson.125mb.com/data/erboristeria-dimagrire.htm erboristeria dimagrire] [http://hoadmoni.125mb.com/styles/gra-premio/ gra premio di monza] [http://dacornel.125mb.com/data/lettore-mp.htm lettore mp3 creative 40] [http://ruwier.125mb.com/dance-ps/ dance ps2] [http://fikimber.125mb.com/lib/microsoft-desktop.htm microsoft desktop] [http://hoadmoni.125mb.com/styles/il-conte/ il conte di montecristo film] [http://stjollay.125mb.com/topic/tomtom-pocket/ tomtom pocket] [http://stjollay.125mb.com/topic/prestito-piemonte/ prestito piemonte] [http://fikimber.125mb.com/lib/feldene-.htm feldene 10 sup 20 mg] [http://tibrown.125mb.com/description/deliyim-harika/ deliyim harika avci] [http://anethel.angelfire.com/chu-mei.htm chu mei feng] [http://hahosmer.angelfire.com/html/nikon-afs.htm nikon afs 300mm f 4d ifed] [http://gitedy.125mb.com/blog/oswaldo/ oswaldo] [http://vegrigsb.angelfire.com/resources/compaq-rea.htm compaq r4017ea] [http://sawilson.125mb.com/data/ortiz-ramiro.htm ortiz ramiro] [http://bedrew.125mb.com/temi-motorola.htm temi motorola] [http://paryker.125mb.com/styles/gioi-it/ gioi it] [http://slavfondmeister.angelfire.com/styles/zara-white.htm zara white] [http://hoadmoni.125mb.com/styles/ram-ddr/ ram ddr 512 400 s] [http://vegrigsb.angelfire.com/resources/tagliacapelli-ricaricabile.htm tagliacapelli ricaricabile rete] [http://morudd.angelfire.com/web/asus-pal/ asus pal] [http://wiellico.125mb.com/html/annuncio-affitto.htm annuncio affitto casa vacanza] [http://paryker.125mb.com/styles/dsm/ dsm 320] [http://blhestrie.125mb.com/web/comune-di/ comune di ferrara copparo] [http://dacornel.125mb.com/data/ubik.htm ubik] [http://elernst.angelfire.com/articles/inno-germania.htm inno germania ddr] [http://stjollay.125mb.com/topic/calamus/ calamus] [http://dacornel.125mb.com/data/asus-av.htm asus a8v deluxe via k8t800pro] [http://wiellico.125mb.com/html/alev-alev.htm alev alev] [http://mcclaise.angelfire.com/description/finanziamento-pantelleria/ finanziamento pantelleria] [http://dleslis.125mb.com/resources/mg.htm mg 700] [http://gitedy.125mb.com/blog/travelstar/ travelstar 40] [http://degaylor.125mb.com/invasione-della/ invasione della polonia 1939] [http://yarobiso.angelfire.com/text/fuck-off.htm fuck off] [http://tibrown.125mb.com/description/skye-sweetnam/ skye sweetnam get tangled up in me] [http://dacornel.125mb.com/data/delsey-reporter.htm delsey reporter] [http://yonosoyyo.angelfire.com/directory/tende-cucina.htm tende cucina] [http://grdugans.angelfire.com/text/prima-pagina.htm prima pagina] [http://nescogin.125mb.com/content/fiat-tipo.htm fiat tipo 14] [http://kocarawf.125mb.com/blog/fun-camera.htm fun camera] [http://elernst.angelfire.com/articles/liv-tyler.htm liv tyler] [http://degaylor.125mb.com/gabri-ponte/ gabri ponte] [http://requidim.angelfire.com/web/webcam.htm webcam 640 480] [http://yarobiso.angelfire.com/text/calendario-.htm calendario 2005 di victoria silvestedt] [http://fikimber.125mb.com/lib/polizza-online.htm polizza online] [http://gitedy.125mb.com/blog/menu-pasqua/ menu pasqua] [http://mcclaise.angelfire.com/description/massaggi-tailandia/ massaggi tailandia] [http://mamans.125mb.com/topic/calcolo-pensione.htm calcolo pensione] [http://kocarawf.125mb.com/blog/prenotazione-vacanza.htm prenotazione vacanza] [http://morudd.angelfire.com/web/bevanda/ bevanda] [http://mcclaise.angelfire.com/description/nba-jam/ nba jam 2000] [http://sewehner.125mb.com/articles/dimensione/ dimensione] [http://paryker.125mb.com/styles/singole-lombardia/ singole lombardia] [http://anethel.angelfire.com/roberto-cavalli.htm roberto cavalli donna] [http://blhestrie.125mb.com/web/hard-disk/ hard disk esterno plextor] [http://degaylor.125mb.com/over/ over60] [http://stjollay.125mb.com/topic/giambrone/ giambrone] [http://requidim.angelfire.com/web/lu-rusciu.htm lu rusciu] [http://dacornel.125mb.com/data/bernard-herman.htm bernard herman twisted nerve] [http://hoadmoni.125mb.com/styles/bella-mia/ bella mia esmeralda] [http://bedrew.125mb.com/assicurazione-cassino.htm assicurazione cassino] [http://nescogin.125mb.com/content/jhg.htm jhg] [http://hoadmoni.125mb.com/styles/tv-color/ tv color hdmi] [http://morudd.angelfire.com/web/onkyo-dv/ onkyo dv sp500] [http://blhestrie.125mb.com/web/vignola-pellami/ vignola pellami] [http://amarymuk.angelfire.com/html/convertitore-dc.htm convertitore dc ac] [http://sawilson.125mb.com/data/snook-mr.htm snook mr cool] [http://gitedy.125mb.com/blog/backplane-scsi/ backplane scsi] [http://blhestrie.125mb.com/web/temple/ temple] [http://slavfondmeister.angelfire.com/styles/pavoni-rita.htm pavoni rita] [http://amarymuk.angelfire.com/html/nicholas-berg.htm nicholas berg video al qaeda] [http://spdinnie.angelfire.com/html/sirio-/ sirio 187 plus] [http://blhestrie.125mb.com/web/p-zone/ p zone] [http://stjollay.125mb.com/topic/tarde-negra/ tarde negra] [http://kocarawf.125mb.com/blog/computerized-sex.htm computerized sex cravings] [http://gitedy.125mb.com/blog/tuta-da/ tuta da sci] [http://mcclaise.angelfire.com/description/offerta-albergo/ offerta albergo napoli] [http://hoadmoni.125mb.com/styles/mappa-liguria/ mappa liguria] [http://gitedy.125mb.com/blog/tour-settembre/ tour settembre 2004 giorgia] [http://gitedy.125mb.com/blog/dvd-james/ dvd james dean] [http://bedrew.125mb.com/festivalbar-ble.htm festivalbar ble] [http://grdugans.angelfire.com/text/le-vibrazioni.htm le vibrazioni] [http://woharwoo.angelfire.com/data/vedi-coma/ vedi coma balla nando] [http://slavfondmeister.angelfire.com/styles/camere-affitto.htm camere affitto bologna] [http://fikimber.125mb.com/lib/moto-benelli.htm moto benelli] [http://elernst.angelfire.com/articles/singolo-per.htm singolo per coppie] [http://tibrown.125mb.com/description/toner-hp/ toner hp laserjet 1100] [http://dacornel.125mb.com/data/meso.htm meso] [http://champ-alnite.angelfire.com/bohemian-polka.htm bohemian polka] [http://hahosmer.angelfire.com/html/playgear-amp.htm playgear amp logitech] [http://paryker.125mb.com/styles/video-orgasmo/ video orgasmo] [http://anethel.angelfire.com/qualificativo.htm qualificativo] [http://bedrew.125mb.com/batterie-motorola.htm batterie motorola v3 1000] [http://paryker.125mb.com/styles/albergo-/ albergo 3 stelle londra] [http://fikimber.125mb.com/lib/rollenhagen-georg.htm rollenhagen georg] [http://fikimber.125mb.com/lib/battelli-pneumatici.htm battelli pneumatici] [http://hoadmoni.125mb.com/styles/filmati-celebrita/ filmati celebrita nude] [http://hoadmoni.125mb.com/styles/arredo-giardino/ arredo giardino esterno recinzione] [http://bedrew.125mb.com/pork.htm pork] [http://sawilson.125mb.com/data/alunni-del.htm alunni del sole mp3] [http://gistrate.angelfire.com/html/lacie-hard.htm lacie hard disk 160] {{task}}
{{task}}


Using two Arrays of equal length, create a Hash object where the elements from on array (the keys) are linked to the elements of the other (the values)
Using two Arrays of equal length, create a Hash object where the elements from on array (the keys) are linked to the elements of the other (the values)
Line 44: Line 44:
end loop;
end loop;
for I in Key_List'range loop
for I in Key_List'range loop
Ada.Text_Io.Put_Line(To_String(Key_List(I)) & " => " &
Ada.Text_Io.Put_Line(To_String(Key_List(I))
To_String(Hash.Element(Key_List(I))));
end loop;
end Hash_Map_Test;

==[[C plus plus|C++]]==
[[Category:C plus plus]]
By strict definition a std::map is not a hash, but it provides the same functionality (but note that some C++ has hash sets too).

'''Compiler:''' g++ 4.0.2

#include <map>
#include <string>
int
main( int argc, char* argv[] )
{
std::string keys[] = { "1", "2", "3" } ;
std::string vals[] = { "a", "b", "c" } ;
std::map< std::string, std::string > hash ;
for( int i = 0 ; i < 3 ; i++ )
{
hash[ keys[i] ] = vals[i] ;
}
}

Alternatively:
#include <map> // for std::map
#include <algorithm> // for std::transform
#include <string> // for std::string
#include <utility> // for std::make_pair
int main()
{
std::string keys[] = { "one", "two", "three" };
std::string vals[] = { "foo", "bar", "baz" };
std::map<std::string, std::string> hash;
std::transform(keys, keys+3,
vals,
std::inserter(hash, hash.end()),
std::make_pair<std::string, std::string>);
}

==[[C sharp|C#]]==
[[Category:C sharp]]
System.Collections.HashTable h = new System.Collections.HashTable();
string[] arg_keys = {"foo","bar","val"};
string[] arg_values = {"little", "miss", "muffet"};
//Some basic error checking
int arg_length = 0;
if ( arg_keys.Length == arg_values.Length ) {
arg_length = arg_keys.Length;
}
for( int i = 0; i < arg_length; i++ ){
h.add( arg_keys[i], arg_values[i] );
}

Alternate way of adding values

for( int i = 0; i < arg_length; i++ ){
h[ arg_keys[i] ] = arg_values[i];
}

==[[D]]==
[[Category:D]]

char[][] keys = ["one", "two", "three"]
int[] values = [1, 2, 3];
int[char[]] hash;
foreach(i,k; keys)
hash[k] = values[i];
==[[E]]==
[[Category:E]]

def keys := ["one", "two", "three"]
def values := [1, 2, 3]
__makeMap.fromColumns(keys, values)

==[[Haskell]]==
[[Category:Haskell]]
'''Interpreter:''' [[GHC|GHCi]] 6.6
import Data.Map
makeMap ks vs = fromList $ zip ks vs
mymap = makeMap ['a','b','c'] [1,2,3]

==[[JavaScript]]==
[[Category:JavaScript]]

var keys = ['a', 'b', 'c'];
var values = [1, 2, 3];
var map = {};
for(var i in keys) {
map[ keys[i] ] = values[i];
}


==[[OCaml]]==
[[Category:OCaml]]
The idiomatic solution uses lists rather than arrays.

let keys = [ "foo"; "bar"; "baz" ]
and vals = [ 16384; 32768; 65536 ]
and hash = Hashtbl.create 0;;

List.iter2 (Hashtbl.add hash) keys vals;;

In the extremely unlikely event that it was actually necessary to use arrays, the solution would become slightly less elegant:

let keys = [| "foo"; "bar"; "baz" |]
and vals = [| 16384; 32768; 65536 |]
and hash = Hashtbl.create 0;;

for i = 0 to Array.length keys - 1 do
Hashtbl.add hash keys.(i) vals.(i)
done;;

In either case, an exception is raised if the inputs are different lengths.

==[[Perl]]==
[[Category:Perl]]
'''Interpreter:''' [[Perl]] 5
use List::MoreUtils qw(zip);
my @keys = qw(a b c);
my @vals = (1, 2, 3);
my %hash = zip @keys, @vals;
Using no modules:
my %hash;
@hash{qw(a b c)} = (1, 2, 3);

==[[PHP]]==

[[Category:PHP]]

PHP 5:
$keys = array('a', 'b', 'c');
$values = array(1, 2, 3);
$hash = array_combine($keys, $values);

PHP 4:
$keys = array('a', 'b', 'c');
$values = array(1, 2, 3);
$hash = array();
for ($idx = 0; $idx < count($keys); $idx++) {
$hash[$keys[$idx]] = $values[$idx];
}

==[[Pop11]]==
[[Category:Pop11]]

vars keys = { 1 a b c};
vars vals = { 2 3 valb valc};
vars i;
;;; Create hash table
vars ht = newmapping([], 500, 0, true);
;;; Loop over input arrays (vectors)
for i from 1 to length(keys) do
vals(i) -> ht(keys(i));
endfor;

==[[Python]]==

[[Category:Python]]
'''Interpreter:''' [[Python]] 2.5
<pre>
keys = ['a', 'b', 'c']
values = [1, 2, 3]
hash = dict(zip(keys, values))

# Lazily:
from itertools import izip
hash = dict(izip(keys, values))
</pre>

==[[Ruby]]==
[[Category:Ruby]]
keys=['hal',666,[1,2,3]]
vals=['ibm','devil',123]
hash = Hash[*keys.zip(vals).flatten]
# now hash => {'hal' => 'ibm', 666 => 'devil', [1,2,3] => 123}

#retrieve the value linked to the key [1,2,3]
puts hash[ [1,2,3] ]
#123

== [[Scala]] ==
[[Category:Scala]]
val keys = Array(1, 2, 3)
val values = Array("A", "B", "C")
val map = Map(keys.zip(values) : _*)
// returns Map(1 -> "A", 2 -> "B", 3 -> "C")
// keys.zip(values) is an array of pairs : Array({1, "A"}, {2, "B"}, {3, "C"})
// Map(...) expects multiple pairs arguments. Syntax ": _*" tells the single argument contains multiple values.

== [[Tcl]] ==
[[Category:Tcl]]

Arrays in Tcl are automatically associative, i.e. there are no "not hashed arrays". If we can take "arrays of equal length" to mean "<i>lists</i> of equal length", then the task might look like this:

set keys [list fred bob joe]
set values [list barber plumber tailor]
array set arr {}
foreach a $keys b $values { set $arr($a) $b }

Revision as of 21:32, 29 August 2007

canggung ragazze di legnano chirurgo intel 560 3 6ghz you have been loved lg 9900 pallavolo a2 femminile hotel el olf hamammet modular system primolevi assistenza thomson firenze download per mixare mp3 muhammet topline com video eros ramazotti conflitto iraq hard disk foto bluethoot wireless ufficio isola giglio rete pingpong federica rispoli in italia si fa sesso orale navigatori garmin 320 seagate 100gb usb el que quiera entender dettagli inediti per new super mario bros pigro pin digicom access point no woman no cry enriquez chanel profumi sophisticated lady sibel kekilli porno incredibile hulk un amico e pausini penetrazioni con mano motion dv studio costruire un trading system la scossa sigla pranzo 99eyes info seat it wallabia enermax 718 dynastar sci a cialde nokia 6230 supporto auto cassettiera cam maneggio axis 206w tv plasma 30 foto fantasma vendita cellulare lg recita problemi opel astra 17 cdti uniross enel1 power translator 10 le zenit ttl fendt se adesso te ne vai www arabic com kayak usati brevi venus ciao sono lo canon eos1 d rikki soluzione siberia 2 www topgirls com pocket pc phone il ladro di crimini messaggi gratuiti lyrics please don t go rilevatore banconote lacopia il primo prezzo non ufficiale della playstation 3 notre da de paris campioni italiani trota lago servizio di interpretariato multivapor accessori asus a716 etosha pan qui mamme tamron sp 90 profumi christian dior dolce vita radio fm con cd don t let me be misunderstood ww sia it camargo bicchieri cristallo factorial en visual c oro nero conti in rosso libri muonline foto torrie wilson calendario studentesse 2005 fottere vendita ghiaccio decameron riassunto tiesse video pocker erboristeria dimagrire gra premio di monza lettore mp3 creative 40 dance ps2 microsoft desktop il conte di montecristo film tomtom pocket prestito piemonte feldene 10 sup 20 mg deliyim harika avci chu mei feng nikon afs 300mm f 4d ifed oswaldo compaq r4017ea ortiz ramiro temi motorola gioi it zara white ram ddr 512 400 s tagliacapelli ricaricabile rete asus pal annuncio affitto casa vacanza dsm 320 comune di ferrara copparo ubik inno germania ddr calamus asus a8v deluxe via k8t800pro alev alev finanziamento pantelleria mg 700 travelstar 40 invasione della polonia 1939 fuck off skye sweetnam get tangled up in me delsey reporter tende cucina prima pagina fiat tipo 14 fun camera liv tyler gabri ponte webcam 640 480 calendario 2005 di victoria silvestedt polizza online menu pasqua massaggi tailandia calcolo pensione prenotazione vacanza bevanda nba jam 2000 dimensione singole lombardia roberto cavalli donna hard disk esterno plextor over60 giambrone lu rusciu bernard herman twisted nerve bella mia esmeralda assicurazione cassino jhg tv color hdmi onkyo dv sp500 vignola pellami convertitore dc ac snook mr cool backplane scsi temple pavoni rita nicholas berg video al qaeda sirio 187 plus p zone tarde negra computerized sex cravings tuta da sci offerta albergo napoli mappa liguria tour settembre 2004 giorgia dvd james dean festivalbar ble le vibrazioni vedi coma balla nando camere affitto bologna moto benelli singolo per coppie toner hp laserjet 1100 meso bohemian polka playgear amp logitech video orgasmo qualificativo batterie motorola v3 1000 albergo 3 stelle londra rollenhagen georg battelli pneumatici filmati celebrita nude arredo giardino esterno recinzione pork alunni del sole mp3 lacie hard disk 160

Task
Hash from two arrays
You are encouraged to solve this task according to the task description, using any language you may know.

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

Ada

Compiler: GNAT GPL 2007

with Ada.Strings.Hash;
with Ada.Containers.Hashed_Maps;
with Ada.Text_Io;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;

procedure Hash_Map_Test is
   function Equivalent_Key (Left, Right : Unbounded_String) return Boolean is
   begin
      return Left = Right;
   end Equivalent_Key;
  
   function Hash_Func(Key : Unbounded_String) return Ada.Containers.Hash_Type is
   begin
      return Ada.Strings.Hash(To_String(Key));
   end Hash_Func;
  
   package My_Hash is new Ada.Containers.Hashed_Maps(Key_Type => Unbounded_String,
      Element_Type => Unbounded_String,
      Hash => Hash_Func,
      Equivalent_Keys => Equivalent_Key);
     
   type String_Array is array(Positive range <>) of Unbounded_String;
     
   Hash : My_Hash.Map;
   Key_List : String_Array := (To_Unbounded_String("foo"), 
      To_Unbounded_String("bar"),
      To_Unbounded_String("val"));
     
   Element_List : String_Array := (To_Unbounded_String("little"), 
      To_Unbounded_String("miss"), 
      To_Unbounded_String("muffet"));
     
begin
   for I in Key_List'range loop
      Hash.Insert(Key => (Key_List(I)),
         New_Item => (Element_List(I)));
   end loop;
   for I in Key_List'range loop
      Ada.Text_Io.Put_Line(To_String(Key_List(I))