This is my code:-
fib(0,0).
fib(1,1).
fib(F,N) :-
N>1,
N1 is N-1,
N2 is N-2,
F is F1+F2,
fib(F1,N1),
fib(F2,N2),
write(F," ,").
On consulting in GNU Prolog, I am getting:
| ?- consult('C:/GNU-Prolog/bin/fib.pl').
compiling C:/GNU-Prolog/bin/fib.pl for byte code...
C:/GNU-Prolog/bin/fib.pl compiled, 3 lines read - 1253 bytes written, 15 ms
yes
| ?- fib(F,2).
uncaught exception: error(instantiation_error,(is)/2)