Basic containers
Set
S.add(e)
Adds element
e to set S. If e is already in S, S is unchanged.Parameter
S.remove(e)
Removes element
e from set S. If e is not in S, S is unchanged.Parameter
S.update(e, b)
Adds or removes
e from set S:- adds
eifbistrue - removes
eifbisfalse
Parameters
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
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
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
Map
M.put(k, v)
Parameters
k :
K
Key to associate a value to.
v :
V
Value associated to the key.
M.remove(k)
Parameter
k :
K
Key to remove association of.
M.update(k : K, o : option<T>)
Parameters
k :
K
Key to associate or remove.