View Problem

Define an empty map

DiskEdit
clojure
(def m {})
ExpandDiskEdit
cpp C++/CLI .NET 2.0
Hashtable^ hash = gcnew Hashtable;
ExpandDiskEdit
cpp C++/CLI .NET 2.0
Generic::Dictionary<String^, String^>^ dict = gcnew Generic::Dictionary<String^, String^>();
ExpandDiskEdit
cpp
std::map<int, std::string> m;
ExpandDiskEdit
erlang
Map = dict:new(),
ExpandDiskEdit
erlang
Map = orddict:new(),
ExpandDiskEdit
erlang
Map = gb_trees:empty(),
ExpandDiskEdit
erlang
Map = ets:new(the_map_name, [set, private, {keypos, 1}]),
ExpandDiskEdit
fantom
map := [:]
ExpandDiskEdit
fsharp
let map = Map.empty
ExpandDiskEdit
fsharp
let map = new Generic.Dictionary<string, string>()
ExpandDiskEdit
fsharp
let map = new Hashtable()
ExpandDiskEdit
go
m := make(map[int]string)
DiskEdit
groovy
def map = [:]
DiskEdit
groovy
Map map = new HashMap();
DiskEdit
haskell
import qualified Data.Map as M

emptyMap = M.empty

ExpandDiskEdit
java
Map map = new HashMap();
DiskEdit
ocaml
module StringMap = Map.Make (String)
let m = StringMap.empty
DiskEdit
ocaml
let m = Hashtbl.create 42
DiskEdit
perl
# %map = {}
# This was wrong, that would have created a hash with one key
# of the stringified hash reference (HASH(0xNUMBERSHERE)) and a
# value of 'undef', as well as triggering a
# "Reference found where even-sized list expected" with the warnings
# pragma enabled

my %map;
ExpandDiskEdit
php
$map = array();
ExpandDiskEdit
php
$map = array("" => "");
DiskEdit
python
map = {}
DiskEdit
ruby
map = {}
ExpandDiskEdit
scala
val map = mutable.Map.empty
ExpandDiskEdit
scala
val map = mutable.HashMap.empty[String, Int]
DiskEdit
scala
val map = Map()

Submit a new solution for clojure, cpp, erlang, fantom ...