Skip to main content

Basic containers

Set

S.add(e)

Adds element e to set S. If e is already in S, S is unchanged.

Parameter


e :

T

Element to add to the set. Type of e is defined at set declaration.

Fails with

does not fail


Michelson


Related

S.remove(e)

Removes element e from set S. If e is not in S, S is unchanged.

Parameter


e :

T

Element to remove from the set. Type of e is defined at set declaration.

Fails with

does not fail


Michelson


Related

S.update(e, b)

Adds or removes e from set S:
  • adds e if b is true
  • removes e if b is false

Parameters


e :

T

Element to add or remove from the set. Type of e is defined at set declaration.


b :

Boolean to decide whether to add or remove element e.

Fails with

does not fail


Michelson


Related

List

L.prepend(e)

Prepends element e to (ie. puts e in first position of) list L.

(see match with instruction to remove the head element of the list).

Parameter


e :

T

Element to prepend to the set. Type of e is defined at list declaration.

Fails with

does not fail


Michelson


Related

L.reverse()

Reverses the position of elements in L.

It is equivalent to the following code:

var rev : list<T> = [];
for e in L do
rev.prepend(e)
done;
L := rev

Fails with

does not fail


Related

L.concat(l)

Concatenates two values of type string, bytes, or list<T>, or a list of values of type string or bytes.

String

Concatenates two string values.

For example:

const m = concat("Hello ", "Archetype");
/* m is "Hello Archetype" */

It is equivalent to the + operator.

Bytes

Concatenates two bytes values.

For example:

const m = concat(0x48656c6c6f, 0x417263686574797065);
/* m is 0x48656c6c6f417263686574797065 */

List

Concatenates two lists of any element of any type.

It is equivalent to the following code:

var res : list<T> = l;
for e in reverse(L) do
res.prepend(e)
done;
L := res

For example:

const l = concat([1; 2; 3], [4; 5]);
/* l is [1; 2; 3; 4; 5] */

List of values

Concatenates values of a list, of type string or bytes

For example:

const m = concat([ "Hello "; "Archetype "; "world!" ]);
/* m is "Hello Archetype world!"*/

Parameter


List to append to list L.

Fails with

does not fail


Related

Map

M.put(k, v)

Associates key k with value v in map (or big_map) M.

Parameters


k :

K

Key to associate a value to.


v :

V

Value associated to the key.

Fails with

does not fail


Michelson


Related

M.remove(k)

Removes entry key k in map (or big_map) M.

Parameter


k :

K

Key to remove association of.

Fails with

does not fail


Michelson


Related

M.update(k : K, o : option<T>)

Associates or removes the association of key k in map (or big_map) M depending on the value of o:
  • some(v): associates key k with value v
  • none: removes entry key k

Parameters


k :

K

Key to associate or remove.


Option Value to associate a value to the key or remove the key.

Fails with

does not fail


Michelson


Related