c
, e
, r
, f
(½ point for all four)
?- length([1,2,3],Len). ?- append(A,B,[1,2,3]), writeln(A), fail. ?- member(X,[1,2,3]), member(X,[3,4,5]).
p(N)
that prints the numbers between 1 and N
inclusive. It always succeeds.
?- p(3). 1 2 3 true.
?- length([1,2,3],Len). Len = 3. ?- append(A,B,[1,2,3]), writeln(A), fail. [] [1] [1,2] [1,2,3] false. ?- member(X,[1,2,3]), member(X,[3,4,5]). X = 3 .
p(N)
that prints the numbers between 1 and N
inclusive.
p(Max) :- between(1,Max,N), writeln(N), fail. p(_).