Logo

Programming-Idioms

  • Python
  • Pascal
  • Go
x := map[string]int {"one": 1, "two": 2}
x = {"one" : 1, "two" : 2}
x = dict(a=1, b=2, c=3)
uses fgl;
type TMap = specialize TFPGMap<String, Integer>;
var x: TMap;

begin
  x := TMap.Create;
  x['one'] := 1;
  x['two'] := 2;  
end.
with Ada.Containers.Indefinite_Hashed_Maps;
with Ada.Strings.Hash;

use Ada.Containers;
declare
   package Maps is new Indefinite_Hashed_Maps (Key_Type => String,
                                               Element_Type => Integer,
                                               Hash => Ada.Strings.Hash,
                                               Equivalent_Keys => "=");
      
   use Maps;
      
   X : Map := Empty_Map;
begin
   X.Insert ("One", 1);
   X.Insert ("Two", 2);
   X.Insert ("Three", 3);
end;

New implementation...