Create a file for each question in a folder zip folder conta
Create a file for each question, in a folder, zip folder containing your solutions and submit on svn Write a Prolog program to evaluate the Ackermann\'s function ack: ack(0, N) = N + 1 ack(M, 0) = ack(M - 1, 1), M > 0 ack(M, N) = ack(M - 1, ack(M, N - 1)) M > 0, N > 0
Solution
Prolog program to evalute the Ackermann\'s function
ack(0, N, Val) :- Val is N+1.
ack(M, 0, Val) :- M>0, A is M-1, ack(A, 1, Val).
ack(M, N, Val) :- M>0, N>0, A is M-1, Y is N-1, ack(M, Y, Val2), ack(A, Val2, Val).
