在线文档教程

Dict

Dict

警告:不推荐此模块。

如果您需要通用字典,请使用该Map模块。如果您需要操纵关键字列表,请使用Keyword

要将地图转换为关键字,反之亦然,请new在各个模块中使用该功能。

摘要

类型

key()t()value()

功能

delete(dict, key)drop(dict, keys)empty(dict)equal?(dict1, dict2)fetch(dict, key)fetch!(dict, key)get(dict, key, default \ nil)get_and_update(dict, key, fun)get_lazy(dict, key, fun)has_key?(dict, key)keys(dict)merge(dict1, dict2)merge(dict1, dict2, fun)pop(dict, key, default \ nil)pop_lazy(dict, key, fun)put(dict, key, val)put_new(dict, key, val)put_new_lazy(dict, key, fun)size(dict)split(dict, keys)take(dict, keys)to_list(dict)update(dict, key, initial, fun)update!(dict, key, fun)values(dict)

类型

key()

key() :: any

t()

t() :: list | map

value()

value() :: any

功能

delete(dict, key)

delete(t, key) :: t

drop(dict, keys)

drop(t, [key]) :: t

empty(dict)

empty(t) :: t

equal?(dict1, dict2)

equal?(t, t) :: boolean

fetch(dict, key)

fetch(t, key) :: value

fetch!(dict, key)

fetch!(t, key) :: value | no_return

get(dict, key, default \ nil)

get(t, key, value) :: value

get_and_update(dict, key, fun)

get_and_update(t, key, (value -> {value, value})) :: {value, t}

get_lazy(dict, key, fun)

get_lazy(t, key, (() -> value)) :: value

has_key?(dict, key)

has_key?(t, key) :: boolean

keys(dict)

keys(t) :: [key]

merge(dict1, dict2)

merge(t, t) :: t

merge(dict1, dict2, fun)

merge(t, t, (key, value, value -> value)) :: t

pop(dict, key, default \ nil)

pop(t, key, value) :: {value, t}

pop_lazy(dict, key, fun)

pop_lazy(t, key, (() -> value)) :: {value, t}

put(dict, key, val)

put(t, key, value) :: t

put_new(dict, key, val)

put_new(t, key, value) :: t

put_new_lazy(dict, key, fun)

put_new_lazy(t, key, (() -> value)) :: t

size(dict)

size(t) :: non_neg_integer

split(dict, keys)

split(t, [key]) :: {t, t}

take(dict, keys)

take(t, [key]) :: t

to_list(dict)

to_list(t) :: list

update(dict, key, initial, fun)

update(t, key, value, (value -> value)) :: t

update!(dict, key, fun)

update!(t, key, (value -> value)) :: t

values(dict)

values(t) :: [value]