Code for Prolog program to write the elements of the list line by line in Artificial Intelligence
domains
l = integer*
predicates
printlist(l)
clauses
printlist([]).
printlist([X|List]) :-
write(X),nl,
printlist(List).
Output :
Goal: printlist([1,2,3,4])
1
2
3
4
Yes