heptagon/test/good/foldi.ept

25 lines
535 B
Text
Raw Normal View History

2010-07-26 09:34:29 +02:00
const n:int=42
fun f(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
let
acc_out = if i = 0 then true else (a & acc_in);
tel
fun for(a:bool; i:int; acc_in : bool) returns (acc_out : bool)
let
acc_out = if i = 0 then false else (a or acc_in);
2010-07-26 09:34:29 +02:00
tel
fun g(a: bool^n) returns (o:bool)
let
o = foldi<<n>> f (a, true);
2010-07-26 09:34:29 +02:00
tel
node main() returns (o1,o2:bool)
var t:bool^n;
let
t = (true^n) fby (false^n) fby ([ true^n with [5]=false ]) fby ([ false^n with [12]=true ]) fby t;
o1 = g(t);
o2 = foldi<<n>> for (t, true);
tel