Question: Consider the following Prolog program, occurs(1, [X |_], X). occurs(N, [IT], X) :-N > 1, M is N - 1, occurs(M, T, X). What
Consider the following Prolog program, occurs(1, [X |_], X). occurs(N, [IT], X) :-N > 1, M is N - 1, occurs(M, T, X). What is the output of the following query? ?- occurs(3, [10,2,18,54,5], Z).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
