b913edcd5e
On the road to beta is the new Minils AST, for now : * Heptagon and Obc AST changes, * Java code generation, * Recursives Qualnames, * Various bug fixes, * Added partial application for iterators, For instance: ... = map<<n>> (f<<se>>)((t1, t1'))(t2, t3) is translated to: for(int i =...) ... = f(t1, t1', t2[i], t3[i])
31 lines
523 B
Plaintext
31 lines
523 B
Plaintext
|
|
fun substr (x,m: int) returns (d: int; m2:int)
|
|
let
|
|
d = x - m;
|
|
m2 = m;
|
|
tel
|
|
|
|
fun mean<<n: int>> (i: int^n) returns (m: int)
|
|
let
|
|
m = (fold (+) <<n>> (i,0) )/n
|
|
tel
|
|
|
|
|
|
node normalized_movie<<n: int>> (i: int^n) returns (im: int^n)
|
|
var m: async int; trash: int;
|
|
let
|
|
m = async mean<<n>>(i);
|
|
(im,trash) = mapfold substr <<n>> (i fby i, 0 -> !(pre m))
|
|
tel
|
|
|
|
|
|
node main () returns (r:int)
|
|
var f: int^100; nf: int^100; x: int;
|
|
let
|
|
x = 0 fby x+1;
|
|
f = x^100;
|
|
nf = normalized_movie<<100>>(f);
|
|
r = mean<<100>>(nf)
|
|
tel
|
|
|