Test whether L is a valid Prolog list

Viewed 121

I'm doing a bunch of Prolog tasks and I have very little idea of how lists work. I have the following:

is_a_list(+L). Test whether L is a valid Prolog list.

How can I write a predicate for that? What does the + mean?

1 Answers

The following can be simplified to give You the solution You seek .

is_a_list_of_integer([]) .

is_a_list_of_integer([ITEM|LISTs])
:-
prolog:integer(ITEM) ,
is_a_list_of_integer(LISTs)
.

Related