Skip to main content
Version: Next

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>.

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>.

get_and_update: <key, value>(key: key, upd: option<value>, map: t<key, value>) => [option<value>, t<key, value>]

The call Big_map.get_and_update(key, ["None" as "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" as "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" as "Some", v], otherwise ["None" as "None"]. *)

update: <key, value>(key: key, upd: option<value>, map: t<key, value>) => t<key, value>

The call Big_map.update(key, ["None" as "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" as "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.

add: <key, value>(key: key, value: value, map: 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.

remove: <key, value>(key: key, map: 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.

literal: <key, value>(bindings: 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).

of_list: <key, value>(bindings: 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.

mem: <key, value>(key: key, map: 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.

find_opt: <key, value>(key: key, map: t<key, value>) => option<value>

The call Big_map.find_opt(key, map) returns ["None" as "None"] if the key key is present in the big map map; otherwise, it is ["Some" as "Some", v], where v is the value associated to key in map.

find: <key, value>(key: key, map: 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".