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 t<key, value>
is an alias for big_map<key, value>
.
let empty: <key, value>t<key, value>
The value empty
is the empty big map. In some contexts, it is
useful to annotate it with its type, for example:
(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 get_and_update(key, None(), map)
returns a copy of the map
map
without the entry for the key key
in map
(no change if
the key is absent). The call get_and_update(key, Some(value), map)
returns a copy of the 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 update(key, None(), map)
returns a copy of the map map
without the entry for the key key
in map
(no change if the key
is absent). The call update(key, Some(value), map)
returns the 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 get_and_update
.
let add: <key, value>(_: key) => (_: value) => (_: t<key, value>) => t<key, value>
The call add(key, value, map)
returns a copy of the 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 remove(key, map)
returns a copy of the map map
where
the binding for key key
is absent.
let literal: <key, value>(_: list<[key, value]>) => t<key, value>
The call 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 of_list(bindings)
returns a big map from the pairs of
key/value in the list bindings
. Note: Use literal
instead if
using a literal list.
let mem: <key, value>(_: key) => (_: t<key, value>) => bool
The call 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 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 find(key, map)
returns the value associated to key
in
map
. If the key is absent, the execution fails with the string
"MAP FIND"
.