lama_byterun/lama-compiler/regression/test060.lama

19 lines
No EOL
266 B
Text

fun makeLazy (f) {
var flag = [0], value = [0];
fun () {
if flag[0]
then value[0]
else
value[0] := f ();
flag[0] := 1;
value[0]
fi
}
}
val l = makeLazy (fun () {write (1); 800});
val x = read ();
write (l ());
write (l ())