ligo/src/test/contracts/set_arithmetic-1.ligo

18 lines
431 B
Plaintext
Raw Normal View History

// Test set iteration in PascaLIGO
2019-08-21 11:41:57 +02:00
function iter_op (const s : set(int)) : int is
begin
var r : int := 0 ;
function aggregate (const i : int) : unit is
begin
r := r + i ;
end with unit ;
set_iter(aggregate, s) ;
2019-08-21 11:41:57 +02:00
end with r
2019-09-24 00:26:39 +02:00
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)