big_map
Maps from keys to values, lazily accessed and where the bindings key/value are ordered by increasing keys.
type t<key, value> = big_map<key, value>
The type Big_map.t<key, value>
is an alias for big_map<key,
value>
.
let empty: <key, value>t<key, value>
The value Big_map.empty
is the empty big map. In some
contexts, it is useful to annotate it with its type, for example:
(Big_map.empty as big_map<int, string>
.
let get_and_update: <key, value>(_: key) => (_: option<value>) => (_: t<key, value>) => [option<value>, t<key, value>]
The call Big_map.get_and_update(key, None(), map)
returns a
copy of the big map map
without the entry for the key key
in
map
(no change if the key is absent). The call
Big_map.get_and_update(key, Some(value), map)
returns a copy
of the big map map
where there is an entry for the key key
associated with the value value
. In both cases, if there was
already a value v
bound to key
, it is returned as Some(v)
,
otherwise None()
.
let update: <key, value>(_: key) => (_: option<value>) => (_: t<key, value>) => t<key, value>
The call Big_map.update(key, None(), map)
returns a copy of
the big map map
without the entry for the key key
in map
(no change if the key is absent). The call Big_map.update(key,
Some(value), map)
returns the big map map
where there is an
entry for the key key
associated with the value value
. In
both cases, the value originally bound to key
is lost. See
Big_map.get_and_update
.
let add: <key, value>(_: key) => (_: value) => (_: t<key, value>) => t<key, value>
The call Big_map.add(key, value, map)
returns a copy of the
big map map
where there is a binding of key key
to value
value
. If there is a binding for key
in map
, then it is
lost.
let remove: <key, value>(_: key) => (_: t<key, value>) => t<key, value>
The call Big_map.remove(key, map)
returns a copy of the big
map map
where the binding for key key
is absent.
let literal: <key, value>(_: list<[key, value]>) => t<key, value>
The call Big_map.literal(list([[k1,v1], ..., [kn,vn]]))
returns
a big map from the pairs of key/value in the list. Note: The list
must be a literal, not an expression (compile-time list of
values).
let of_list: <key, value>(_: list<[key, value]>) => t<key, value>
The call Big_map.of_list(bindings)
returns a big map from the
pairs of key/value in the list bindings
. Note: Use
Big_map.literal
instead if using a literal list.
let mem: <key, value>(_: key) => (_: t<key, value>) => bool
The call Big_map.mem(key, map)
is true
if, and only if, the
key key
is in the big map map
.
let find_opt: <key, value>(_: key) => (_: t<key, value>) => option<value>
The call Big_map.find_opt(key, map)
returns None()
if the
key key
is present in the big map map
; otherwise, it is
Some(v)
, where v
is the value associated to key
in map
.
let find: <key, value>(_: key) => (_: t<key, value>) => value
The call Big_map.find(key, map)
returns the value associated
to key
in the big map map
. If the key is absent, the
execution fails with the string "MAP FIND"
.