Solution
%% If the list is empty, it's length is obviously 0. list_length([],0). %% If the length of the tail is TailLength, then the length %% of the tail plus the head is TailLength plus 1. list_length([Head|Tail],Length) :- list_length(Tail,TailLength), Length is TailLength + 1.Download the knowledge base here.