foo(0,Y,Z) :- Z is Y.
foo(X,0,Z) :- Z is X.
foo(X,Y,Z) :- X>=Y, M1 is X-2, foo(M1, Y, Zx), Z is Zx + Y.
foo(X,Y,Z) :- Y<X, N1 is Y-3, foo(X, N1, Zx), Z is Zx + X.
So this is my program and this is what i'm trying to accomplish
??????(??, ??) = {
?? ???? ?? ≤ 0
?? ???? ?? ≤ 0
?? + ??????(?? ? 2, ??) ???? ?? ≥ ??
?? + ??????(??, ?? ? 3) ???? ?? < ?? }
Why does my program not output anything? This is what i think i'm saying -
If X = 0, foo(0,Y,Z), than return Z as Y. If Y = 0, foo(0,Y,Z), than return Z as X.
if X>=Y, than do foo again and once that returns than return Z as Zx + Y if X
Am i correct in my thinking?
See Question&Answers more detail:os