TP-traduction-langages/exemples/exemple-11.mml
2021-11-24 18:23:17 +01:00

13 lines
429 B
Plaintext
Executable file

letrec loop = fun fcond -> fun fnext -> fun feval -> fun arg -> fun acc ->
if ((fcond) arg) then acc
else let iter = ((feval) arg) acc in
let next = (fnext) arg in
((((((loop) fcond) fnext) feval) next) iter)
in
let done = fun x -> (x = 0) in
let next = fun x -> (x - 1) in
let eval = fun x -> fun y -> x * y in
((((((loop) done) next) eval) 5) 1)