% File length.pl

% The following predicate len(L,N) holds when 
% N is the length of the list L

len([],0).
len([_|L],N) :- len(L,M), N is M+1.

% Sample session

/*
?- consult('length.pl').
length.pl compiled, 0.00 sec, 400 bytes.

Yes
?- len([a,b,c],N).

N = 3 ;

No
?- len(L,3).

L = [_G230, _G233, _G236] ;
... (loops) ...
^C
Action (h for help) ? abort

Execution Aborted

?- 
*/
