ligo/src/test/contracts/set_arithmetic-1.ligo
Christian Rinderknecht 93682629b4 Updating contracts.
2020-02-27 17:51:29 +01:00

18 lines
447 B
Plaintext

// Test set iteration in PascaLIGO
function iter_op (const s : set (int)) : int is
block {
var r : int := 0;
function aggregate (const i : int) : unit is
block {
r := r + i
} with unit;
set_iter (aggregate, s)
} with r // ALWAYS RETURNS 0
function fold_op (const s : set (int)) : int is
block {
function aggregate (const i : int; const j : int) : int is
i + j
} with set_fold (aggregate, s, 15)