Elixir v1.0.5 Map

A Dict implementation that works on maps.

Maps are key-value stores where keys are compared using the match operator (===). Maps can be created with the %{} special form defined in the Kernel.SpecialForms module.

For more information about the functions in this module and their APIs, please consult the Dict module.

Summary

Functions

Callback implementation for Dict.delete/2

Callback implementation for Dict.drop/2

Callback implementation for Dict.equal?/2

Callback implementation for Dict.fetch/2

Callback implementation for Dict.fetch!/2

Converts a struct to map

Callback implementation for Dict.get/3

Callback implementation for Dict.has_key?/2

Callback implementation for Dict.keys/1

Callback implementation for Dict.merge/2

Returns a new empty map

Callback implementation for Dict.pop/3

Callback implementation for Dict.put/3

Callback implementation for Dict.put_new/3

Callback implementation for Dict.size/1

Callback implementation for Dict.split/2

Callback implementation for Dict.take/2

Callback implementation for Dict.to_list/1

Callback implementation for Dict.update/4

Callback implementation for Dict.update!/3

Callback implementation for Dict.values/1

Functions

delete(map, key)

Callback implementation for Dict.delete/2.

drop(dict, keys)

Callback implementation for Dict.drop/2.

equal?(dict1, dict2)

Callback implementation for Dict.equal?/2.

fetch(map, key)

Callback implementation for Dict.fetch/2.

fetch!(dict, key)

Callback implementation for Dict.fetch!/2.

from_struct(struct)

Converts a struct to map.

It accepts the struct module or a struct itself and simply removes the __struct__ field from the struct.

Example

defmodule User do
  defstruct [:name]
end

Map.from_struct(User)
#=> %{name: nil}

Map.from_struct(%User{name: "john"})
#=> %{name: "john"}
get(dict, key, default \\ nil)

Callback implementation for Dict.get/3.

has_key?(dict, key)

Callback implementation for Dict.has_key?/2.

keys(dict)

Callback implementation for Dict.keys/1.

merge(map1, map2)

Callback implementation for Dict.merge/2.

merge(dict1, dict2, fun \\ fn _k, _v1, v2 -> v2 end)

Callback implementation for Dict.merge/3.

new()

Returns a new empty map.

pop(dict, key, default \\ nil)

Callback implementation for Dict.pop/3.

put(map, key, val)

Callback implementation for Dict.put/3.

put_new(dict, key, value)

Callback implementation for Dict.put_new/3.

size(map)

Callback implementation for Dict.size/1.

split(dict, keys)

Callback implementation for Dict.split/2.

take(dict, keys)

Callback implementation for Dict.take/2.

to_list(dict)

Callback implementation for Dict.to_list/1.

update(dict, key, initial, fun)

Callback implementation for Dict.update/4.

update!(dict, key, fun)

Callback implementation for Dict.update!/3.

values(dict)

Callback implementation for Dict.values/1.