Logo

Programming-Idioms

History of Idiom 8 > diff from v55 to v56

Edit summary for version 56 by roryg:
New Caml implementation by user [roryg]

Version 55

2019-09-26, 19:50:46

Version 56

2019-09-26, 21:39:15

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Idiom #8 Initialize a new map (associative array)

Declare a new map object x, and provide some (key, value) pairs as initial content.

Extra Keywords
table dictionary hash
Extra Keywords
table dictionary hash
Code
module StringMap = Map.Make(String)

let x =
    StringMap.empty
    |> StringMap.add "one" 1
    |> StringMap.add "two" 2
    |> StringMap.add "three" 3