If the number of arguments is zero then we speak about atom . A special type of atom is number . Study following program to find where the possible problems are hidden. Lists List is a widely used data structure which is build in Prolog. The following functions enable access to list elements.
T is list It is easy to access the first element of list as it corresponds to the head.
However, finding the last element is a time consuming process as one has to go through the whole list to find it. The similar conclusion also holds for finding prefix and suffix respectively. Testing membership is an important method for working with lists. Prolog definiton of member can test membership relation as well as generate successive members of list. Another popular function on lists is append which appends a list to another list.