X = (abc, def, ghi, jkl).
That is a set of symbols; prolog doesn't recognize non-types(int,long,double,...).
A list is represented by a head(first element) and a tail(the remaining elements).
Try running the following examples:
?- [1,2,3,4,5,6]=[Head|Tail].
?- [1,2,3,4,5,6]=[First,Second|Tail].
Now you need to get familiarized with recursion(it is the heart of prologue).
An insertion procedure might look like:
insert(X, List, [X|List]).
But what if the list is empty; our procedure thinks that list is not so we need another procedure to suffice the previous:
insert(X, [], [X|]).
We can do more: for instance check if an item is present within a list:
present(Item,[Item|_]).
present(Item,[_|Tail]) :-
present(Item,Tail).
Notice the recursion in our last procedure: present(Item, Tail) - this recursively checks the head of the list with the variable Item which can be read from the keyboard:
check_if_present :- read(X), present(X, List).
where List has been created at an earlier point.
We can also concatenate lists very easily:
concatenating([],List,List).
concatenating([Head|Tail],List,[Head|ResultedTail]) :-
concatenating(Tail,List,ResultedTail).