ciao
ciao copied to clipboard
uncaught memory overflow in ciaowasm (was Cannot distinguish error from failure")
There is a strange behaviour on my machine with the new Ciao WASM Playground:
?- time2(fac(s(s(s(s(s(s(s(s(s(s(n)))))))))), _)).
% walltime 520.0 ms
yes
?- time2(fac(s(s(s(s(s(s(s(s(s(s(s(n))))))))))), _)).
no
?- fail.
no
I guess JavaScript WASM run out of memory. But somehow the error is not noticed or ignored. Would it be possible to show the out of memory?
P.S.: Was using this code:
add(n, X, X).
add(s(X), Y, Z) :- add(X, s(Y), Z).
mul(n, _, n).
mul(s(X), Y, Z) :- mul(X, Y, H), add(Y, H, Z).
fac(n, s(n)).
fac(s(X), Y) :- fac(X, H), mul(s(X), H, Y).
Thanks! This is definitely a bug.
Looking at values reported by statistics/0 it seems that some memory overflow is not handled correctly.