Login
|
Signup
langref.org
-
python
,
csharp
,
erlang
, and
fsharp
add..
all
clojure
cpp
fantom
go
groovy
haskell
java
ocaml
perl
php
ruby
scala
Home
All
Solved
Unsolved
Strings
Numbers
Regex
Lists
Maps
Structure
Files
Dates
OOP
Networking
XML
Algorithms
Misc
Parallel
View Problem
Maps
Declaration
Define an empty map
python
map = {}
map = {}
erlang
Map = dict:new(),
-module(emptymap).
-export([start/0]).
start() ->
Map = dict:new(),
io:format("~B~n", [dict:size(Map)]).
erlang
Map = orddict:new(),
-module(emptymap).
-export([start/0]).
start() ->
Map = orddict:new(),
io:format("~B~n", [orddict:size(Map)]).
erlang
Map = gb_trees:empty(),
-module(emptymap).
-export([start/0]).
start() ->
Map = gb_trees:empty(),
io:format("~B~n", [gb_trees:size(Map)]).
erlang
Map = ets:new(the_map_name, [set, private, {keypos, 1}]),
-module(emptymap).
-export([start/0]).
start() ->
Map = ets:new(the_map_name, [set, private, {keypos, 1}]),
io:format("~B~n", [ets:info(Map, size)]).
fsharp
let map = Map.empty
#light
open System
open System.Collections
let map = Map.empty
fsharp
let map = new Generic.Dictionary<string, string>()
#light
open System
open System.Collections
let map = new Generic.Dictionary<string, string>()
fsharp
let map = new Hashtable()
#light
open System
open System.Collections
let map = new Hashtable()
Submit a new solution for
python
,
csharp
,
erlang
, or
fsharp
There are 19 other solutions in
additional
languages (
clojure
,
cpp
,
fantom
,
go
...)